home *** CD-ROM | disk | FTP | other *** search
Text File | 1985-09-05 | 148.3 KB | 6,074 lines |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- LADYBUG GRAPHICS
-
- REFERENCE MANUAL
-
- VERSION 1.0
-
-
-
-
-
- 14 March 1984
-
-
-
-
-
-
-
-
-
- David N. Smith
-
- 44 Ole Musket Lane
- Danbury, CT 06810
-
-
-
-
-
-
-
-
-
- (c) Copyright 1983 and 1984 by David N. Smith
- All Rights Reserved.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PREFACE
-
-
- LadyBug is an implementation of LOGO Turtle Graphics. It is
- distributed as "User-Supported" software which means that you do
- not have to pay for it. You can copy it, give it away, or do
- anything else with it except sell it.
-
- If you find that it is useful, you are invited to make a donation
- of $35 to the author. The donation is voluntary and in no way
- should be considered as payment for software or services.
-
- Under no circumstances should school teachers feel any obligation
- to make a donation. One teacher said she has $100 per year for
- software, shared between three teachers, and that she would send
- a donation when they raised money from selling candy. If that is
- your kind of circumstance, please accept LadyBug with the
- author's compliments.
-
- The author is:
-
- David N. Smith
- 44 Ole Musket Lane
- Danbury, CT 06810
-
- The author can also be reached by US mail or EMAIL on CompuServe
- to userid 73145,153. Please do not phone.
-
-
-
- DISCLAIMER
-
- LadyBug comes with no warranties of any kind; it is available AS
- IS. The author would like to know of problems that users have
- but makes no promise or guarantees that any problem will be
- fixed. Please dont feel that a donation is necessary to report a
- problem or suggest an improvement; it isn't! In fact, exactly
- the opposite might be true.
-
- IN NO EVENT WILL THE AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING
- ANY LOST PROFITS, LOST SAVINGS, FAILURE TO EDUCATE, OR OTHER
- INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF OR
- INABILITY TO USE THIS PROGRAM, EVEN IF THE AUTHOR HAS BEEN
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY
- ANY OTHER PARTY.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Preface Page ii
-
-
- COPYING LADYBUG
-
- Educational institutions, clubs, and other nonprofit
- organizations as well as individuals are granted permission to
- freely copy LadyBug and its documentation and share them with
- their members or students, or individuals with their friends, so
- long as:
-
- 1. No price is charged for the software or documentation.
- However, clubs and other nonprofit organizations may charge a
- distribution fee of up to $6 to cover expenses.
- 2. Neither the program nor its documentation are modified in any
- way and are distributed together.
-
- Other organizations, and individuals, are allowed to copy LadyBug
- only if done without charge and so long as the other rules above
- are followed.
-
- Educational instutitions, clubs, and other nonprofit
- organizations may make printed copies of this document for
- distribution to members, or students of the institution, provided
- that any price charged does not exceed the actual cost of the
- duplication of the copy, and provided that the document is
- reproduced in its entirety including all copyright and
- restrictive notices.
-
- NOTICE: LadyBug is NOT in the public domain. The author retains
- ownership of the program and its copyright.
-
-
-
- USER SUPPORTED SOFTWARE
-
- User-supported software was conceived by Andrew Fluegelman of
- Headlands Press for PC-TALK. He used the name FreeWare(tm). Jim
- Button, distributor of PC-FILE, coined the term user-supported
- software.(1)
-
-
-
-
-
-
-
-
-
-
-
-
- ____________________
-
- (1) User-supported does NOT mean that the user must support
- herself. It means that the user herself supports the idea of
- freely distributed software.
-
-
-
-
-
-
-
-
-
- Preface Page iii
-
-
- SOURCE
-
- LadyBug is distributed as compiled Basic; source is NOT
- distributed nor is it available.
-
-
-
- HOW TO GET LADYBUG
-
- If you do not have LadyBug, or if your copy is not current, you
- can get a new copy by sending the author a diskette and a postage
- paid mailer. You get LadyBug with documentation on disk. In any
- case, please mark LADYBUG on the OUTSIDE of the envelope. Send
- no money; it is free.
-
- LadyBug is available from an ever increasing list of other
- sources. In particular the Young Peoples LOGO Association
- distributes LadyBug as well as hundreds of procedures written in
- LOGO. Chapter 1 gives their address.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TABLE OF CONTENTS
-
-
- 1. ABOUT LADYBUG AND LOGO................................. 1
- 1.1. LadyBug Features................................... 2
- 1.2. LadyBug Requirements............................... 2
- 1.3. Additions and Changes From Version 0.9............. 3
- 1.4. Why not LadyBug?................................... 3
- 1.5. LadyBug Procedure Library.......................... 4
- 1.6. Thanks To ---...................................... 4
-
- 2. RUNNING LADYBUG........................................ 5
- 2.1. Before You Run LadyBug............................. 5
- 2.2. Starting........................................... 5
- 2.3. LadyBug Function Keys.............................. 5
- 2.4. Trying Things...................................... 6
- 2.5. Setting Up a LadyBug Diskette...................... 7
- 2.6. When Something Goes Wrong.......................... 8
-
- 3. THE WORKSPACE.......................................... 9
-
- 4. THE LADYBUG SCREENS.................................... 10
- 4.1. The Graphics Screen................................ 10
- 4.2. The Text Screen.................................... 11
- 4.3. The Editing Screen................................. 11
- 4.4. Using Two Displays................................. 11
-
- 5. THINGS WHICH MAKE UP COMMANDS.......................... 12
- 5.1. Words.............................................. 12
- 5.2. Numbers............................................ 12
- 5.3. Lists.............................................. 12
- 5.4. Strings............................................ 13
- 5.5. About Capital Letters.............................. 13
- 5.6. Expressions........................................ 13
-
- 6. GRAPHICS COMMANDS...................................... 14
- 6.1. BACK length (Abbreviated BK).................... 14
- 6.2. BACKGROUND color (Abbreviated BG)............... 14
- 6.3. CLEARSCREEN (Abbreviated CS).................... 15
- 6.4. CLIP............................................... 15
- 6.5. DRAW............................................... 15
- 6.6. FORWARD length (Abbreviated FD).................. 15
- 6.7. HIDEBUG (Abbreviated HB)........................ 16
- 6.8. HIDETURTLE (Abbreviated HT)..................... 16
- 6.9. HOME............................................... 16
- 6.10. LEFT angle (Abbreviated LT)..................... 16
- 6.11. NOCLIP............................................ 16
- 6.12. NODRAW (Abbreviated ND)......................... 17
- 6.13. NOWRAP............................................ 17
- 6.14. NOWINDOW.......................................... 17
- 6.15. PAINT paintcolor bordercolor...................... 17
- 6.16. PALETTE palettenumber............................. 18
- 6.17. PENCOLOR color (Abbreviated PC)................. 18
- 6.18. PENDOWN (Abbreviated PD)........................ 18
-
-
-
-
-
-
-
-
-
- Table of Contents Page v
-
-
- 6.19. PENUP (Abbreviated PU).......................... 19
- 6.20. RIGHT angle (Abbreviated RT).................... 19
- 6.21. SETHEADING angle (Abbreviated SETH)............. 19
- 6.22. SETBG color....................................... 19
- 6.23. SETPAL palette.................................... 20
- 6.24. SETPC color....................................... 20
- 6.25. SETSCRUNCH n (Also: .SETSCRUNCH)................ 20
- 6.26. SETX xcoord....................................... 20
- 6.27. SETXY xcoord ycoord............................... 21
- 6.28. SETY ycoord....................................... 21
- 6.29. SHOWBUG (Abbreviated SB)........................ 21
- 6.30. SHOWTURTLE (Abbreviated ST)..................... 21
- 6.31. WINDOW............................................ 22
- 6.32. WRAP.............................................. 22
-
- 7. SOUNDS................................................. 23
- 7.1. BEEP............................................... 23
- 7.2. PLAY string........................................ 23
- 7.3. TONE frequency n................................... 24
-
- 8. INPUT AND OUTPUT....................................... 25
- 8.1. CLEARTEXT (Abbreviated CT)....................... 25
- 8.2. CLEARINPUT......................................... 25
- 8.3. CURSOR column row.................................. 25
- 8.4. PRINT word (Abbreviated PR)...................... 25
- 8.5. PRINT1 word (Abbreviated PR1).................... 26
- 8.6. TYPE word.......................................... 26
- 8.7. SETWIDTH columns................................... 26
- 8.8. TEXTCOLUMNS columns (Abbreviated TCOLS).......... 26
-
- 9. CONTROL COMMANDS....................................... 27
- 9.1. EDIT procname ... (Abbreviated ED)............... 27
- 9.2. EDIT ALL........................................... 27
- 9.3. END................................................ 27
- 9.4. ERROR message...................................... 27
- 9.5. FOREVER list....................................... 28
- 9.6. GOODBYE (Abbreviated BYE)........................ 28
- 9.7. IF condition THEN action........................... 28
- 9.8. IF condition [action].............................. 28
- 9.9. IF condition THEN action1 ELSE action2............. 29
- 9.10. IF condition [action1] [action2].................. 29
- 9.11. IFFALSE list...................................... 30
- 9.12. IFTRUE list....................................... 30
- 9.13. LOCAL variablename................................ 30
- 9.14. MAKE "variablename value.......................... 31
- 9.15. OUTPUT value (Abbreviated OP)................... 32
- 9.16. RANDOMIZE number.................................. 32
- 9.17. REPEAT number list................................ 32
- 9.18. RUN list.......................................... 33
- 9.19. STOP.............................................. 33
- 9.20. TEST condition.................................... 33
- 9.21. TOPLEVEL.......................................... 33
- 9.22. WAIT time......................................... 33
- 9.23. WHILE condition list.............................. 34
-
-
-
-
-
-
-
-
-
- Table of Contents Page vi
-
-
-
- 10. MANAGING THE WORKSPACE................................ 35
- 10.1. CATALOG (Abbreviated CAT)....................... 35
- 10.2. CLEARWS........................................... 35
- 10.3. DEFINE "name list................................. 35
- 10.4. EDIT procname .................................... 36
- 10.5. EDIT ALL.......................................... 36
- 10.6. ERASE procedurename............................... 36
- 10.7. ERASE ALL......................................... 36
- 10.8. ERASEFILE filename................................ 37
- 10.9. ERNAME variablename............................... 37
- 10.10. ERNAME ALL....................................... 37
- 10.11. LOAD filename.................................... 37
- 10.12. PRINTOUT name (Abbreviated PO)................. 37
- 10.13. READ filename.................................... 37
- 10.14. SAVE filename.................................... 38
- 10.15. TO procname inputs............................... 38
-
- 11. RUNNING AND DEBUGGING PROCEDURES...................... 39
- 11.1. Running Procedures................................ 39
- 11.2. Pausing Procedures................................ 39
- 11.3. Editing Active Procedures......................... 40
- 11.4. CONTINUE (Abbreviated CO)...................... 40
- 11.5. NOTRACE........................................... 40
- 11.6. PAUSE............................................. 40
- 11.7. TOPLEVEL.......................................... 40
- 11.8. TRACE............................................. 41
- 11.9. ; (comment)...................................... 41
-
- 12. NUMBERS AND COMPUTATIONS.............................. 42
- 12.1. Values............................................ 42
- 12.1.1. Numeric Values................................ 42
- 12.1.2. Mathematical Values........................... 43
- 12.2. Graphics Words.................................... 44
- 12.3. Other Words....................................... 45
- 12.4. Expressions Resulting in Numbers.................. 46
- 12.5. Expressions Resulting in True or False............ 47
- 12.6. Procedures........................................ 48
-
- 13. WORKSPACES WITH TOOLS................................. 49
- 13.1. AND t/f t/f..................................... 49
- 13.2. FOREVER list...................................... 49
- 13.3. MAX value1 value2................................. 49
- 13.4. MIN value1 value2................................. 49
- 13.5. OR t/f t/f...................................... 50
- 13.6. WAIT time......................................... 50
- 13.7. WHILE [condition] [commands]...................... 50
- 13.8. XOR t/f t/f..................................... 50
-
- 14. INTRODUCTION TO THE LADYBUG EDITOR.................... 51
- 14.1. About the Editor.................................. 51
- 14.2. Invoking the Editor............................... 51
- 14.3. The LadyBug Editor Keys........................... 52
-
-
-
-
-
-
-
-
-
-
- Table of Contents Page vii
-
-
- 15. HINTS ON USING LADYBUG................................ 54
- 15.1. Printing the Screen On an IBM or Epson Printer.... 54
- 15.2. Printing the Screen On Other Printers............. 54
- 15.3. Tailoring LadyBug: The Profile.................... 54
- 15.4. The READ Command.................................. 54
- 15.5. Performance Hints................................. 55
-
- APPENDIX A. ABOUT THE LADYBUG EDITOR...................... 57
- A.1. The LadyBug Editor Keys............................ 57
-
- APPENDIX B. THE PLAY COMMAND.............................. 60
- B.1. Music Commands..................................... 60
- B.2. Examples of Play Statements........................ 63
-
- APPENDIX C. A GUIDE TO EXAMPLE PROCEDURES................. 64
- C.1. BCAKE.............................................. 64
- C.2. C.................................................. 64
- C.3. DYNA............................................... 64
- C.4. DRAGON............................................. 65
- C.5. DUOPOLY............................................ 65
- C.6. HILBERT............................................ 65
- C.7. INSPI.............................................. 65
- C.8. LUDWIG............................................. 66
- C.9. MISC............................................... 66
- C.10. POLY.............................................. 66
- C.11. POLYSPI........................................... 67
- C.12. RAIL.............................................. 67
- C.13. SLINKY............................................ 67
- C.14. SNOWFLAK.......................................... 68
- C.15. SPIRO............................................. 68
- C.16. SOUNDS............................................ 68
- C.17. SPINSQ............................................ 69
- C.18. TREES............................................. 69
-
- APPENDIX D. FORMAT AND CONTENTS OF SAVED WORKSPACES....... 70
-
- APPENDIX E. ERROR MESSAGES................................ 71
-
- APPENDIX F. HACKERS ONLY.................................. 74
- F.1. .DEBUG............................................. 74
- F.2. .STACK............................................. 74
- F.3. .SYMTAB............................................ 74
- F.4. Names that return values........................... 74
-
- APPENDIX G. LIMITS AND CAPACITIES......................... 76
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1. ABOUT LADYBUG AND LOGO
-
-
- LadyBug is a graphics language based on LOGO Turtle Graphics. It
- contains most of the graphics commands, procedure making
- commands, and control commands from the Apple II(2)
- implementation of LOGO done by Terrapin, Inc. This version is
- described in the book LOGO FOR THE APPLE II, by Harold Abelson,
- published by McGraw-Hill in 1982. It is very similar to other
- versions for the Apple II, IBM PC, Texas Instruments, and
- TRS-80(3) computers. Words from other LOGO implementations are
- included for compatibility.
-
- This manual describes the LadyBug language but is not an
- introduction to LOGO. We highly recommend the book LOGO FOR THE
- APPLE II for its very understandable presentation of LOGO and for
- its many examples.
-
- DISCOVERING APPLE LOGO by David D. Thornburg is another very
- readable, although less complete, introduction to LOGO. It was
- published by Addison-Wesley in 1983.
-
- For children, or adults who are going to work with children, the
- book LEARNING WITH LOGO, Daniel Watt, McGraw-Hill, 1983, is
- highly recommended. It is written by a person who is both an
- elementary teacher, and who has worked with the LOGO group at MIT
- for many years.
-
- The book TURTLE GEOMETRY, Abelson and diSessa, MIT Press, 1980 is
- recommended for more advanced users. It takes the form of a
- college text book on mathematics using Turtle Graphics as the
- mechanism.
-
- A good source of ideas and programs is the Young People's LOGO
- Association, 1208 Hillsdale Drive, Richardson, TX 75081. On
- CompuServe, YPLA can be reached at 70130,250 and on the Source
- they are T10143. YPLA publishes a monthly newsletter and has a
- large library of public domain LOGO software for a wide variety
- of machines.
-
- Of course, MINDSTORMS, Seymour Pappert, Basic Books, 1980 is the
- ultimate source of WHY LOGO.
-
-
-
-
-
-
-
-
- ____________________
-
- (2) Apple II is a Trademark of Apple, Inc.
- (3) TRS-80 is a Trademark of Tandy.
-
-
-
-
-
-
-
-
-
- About LadyBug and LOGO Page 2
-
-
- 1.1. LADYBUG FEATURES
-
- LadyBug is a version of LOGO patterned after the Apple II
- implementation developed by Terrapin, Inc. and with features
- from other LOGO systems. In general it has most of the graphics
- commands, the mathematical computations, and the control
- commands, of Apple LOGO. In addition it has:
-
- - Commands and words from various other LOGO implementations.
- Commands with the same names as IBM LOGO commands are mainly
- compatible with IBM LOGO.
- - A library of procedures adapted from a variety of sources.
- - Painting of areas.
- - Clipping of drawings (as well as wraparound).
- - A fast full screen editor.
- - Support for using both displays if both are present.
- - Sounds -- PLAY statement like Basic.
-
- The major features missing are:
-
- - List manipulation.
- - Variable numbers of parameters to primitives.
- - Saving screen images.
-
-
-
- 1.2. LADYBUG REQUIREMENTS
-
- LadyBug requires a system with at least:
-
- - 128K of memory.
- - One single sided disk drive.
- - A graphics adaptor.
- - A graphics display of any kind. Color is supported only on a
- color display; 80 column editing is supported only on a high
- resolution monitor. A color TV set will work but colors will
- not be accurate.
- - DOS 1.1, 2.0, or 2.1. (DOS 1.0 has not been tested.)
- - An IBM PC, PCjr, or compatible machine.
-
- The distribution diskette is double sided and requires DOS 1.1 or
- later. Files for execution of LadyBug can be copied to a single
- sided diskette.
-
- The IBM Monochrome display is also supported, if present, for
- editing and when in text mode. References in this document to
- "the Monochrome display" refer to the IBM Monochrome display and
- not to a black and white graphics monitor.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- About LadyBug and LOGO Page 3
-
-
- 1.3. ADDITIONS AND CHANGES FROM VERSION 0.9
-
- The changes made in version 1.0, as compared to version 0.9,
- include:
-
- - returning values from procedures;
- - help key;
- - pausing procedures and then continuing;
- - SETSCRUNCH to adjust aspect ratios;
- - TEST, IFTRUE, and IFFALSE commands;
- - some list support;
- - some IBM LOGO syntax compatibility;
- - expanded limits for the size of procedures, number of lines
- to edit, and sizes of constants;
- - text screen support;
- - tools workspaces; and
- - many new builtin functions.
-
- Many smaller changes have also been made. In addition the manual
- has been expanded with additional information, examples, and an
- index.
-
-
-
- 1.4. WHY NOT LADYBUG?
-
- LadyBug was written as an introduction to LOGO and Turtle
- Graphics.(4) The author recommends that those with a serious need
- for LOGO investigate the use of a commercial version of LOGO
- rather than LadyBug. There are several reasons:
-
- 1. LadyBug is slower.
- 2. LadyBug doesn't do as much.
- 3. LadyBug is not supported in the same sense the commercial
- versions are supported. If you have a bug, then you might
- have a bug forever.
- 4. LadyBug will not grow and progress significantly with time.
- 5. LadyBug is not as well documented.
-
- In particular, the IBM version of LOGO is a very powerful
- implementation which also runs under PC/DOS. It stores
- workspaces in a manner similar to LadyBug; conversion to it
- should not be difficult.
-
-
-
-
-
-
-
- ____________________
-
- (4) In particular, it was done for the author's children;
- thoughts of distribution only came later.
-
-
-
-
-
-
-
-
-
- About LadyBug and LOGO Page 4
-
-
- 1.5. LADYBUG PROCEDURE LIBRARY
-
- There is not much now except those in the Tools chapter and in
- the Appendix on example procedures. I hope that LadyBug users
- will contribute procedures to a library so that other users can
- share their efforts. Contirbute them either to the author or to
- the Young Peoples LOGO Association.
-
-
-
- 1.6. THANKS TO ---
-
- Thanks to the inventors of LOGO for inventing it.
-
- Thanks to my children for playing with LadyBug.
-
- Thanks to all of those who ran version 0.9 and sent problem
- reports and requests for changes. The bugs have been fixed and
- as many features have been added as possible.
-
- Thanks to ReadiWriter, a very powerful text formatter, for making
- it so easy to do a document this complex. In particular, the
- indexing was a breeze; without a program like ReadiWriter there
- wouldn't have been an index.
-
- Thanks to all of those who have made suggestions, found bugs, and
- helped out in many other ways.
-
- And thanks to my wife for putting up with me while I wrote
- LadyBug.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 2. RUNNING LADYBUG
-
-
-
- 2.1. BEFORE YOU RUN LADYBUG
-
- The LadyBug diskette should be backed up. Never run the only one
- you have if you value being able to run LadyBug tomorrow.
-
- LadyBug is initially distributed on double sided diskettes. If
- you have single sided drives you should get a friend to copy the
- files onto diskettes formatted for single sided use.
-
- Although LadyBug will run with the diskette setup as distributed,
- a section below describes how to set up working disks in order to
- maximize the amount of working space and to make them self
- booting.
-
-
-
- 2.2. STARTING
-
- Boot DOS up. Put the LadyBug diskette into the A: drive.(5) Type
- "LADYBUG". After a few seconds you will be in LadyBug command
- mode.
-
-
-
- 2.3. LADYBUG FUNCTION KEYS
-
- The LadyBug function keys control how LadyBug programs run or
- stop them from running. They may be used any time that LadyBug
- is running. When LadyBug is waiting for input you will have to
- press the enter key before the action takes effect. (In the
- editor, the function keys have different meanings.)
-
- F1
- Stop a running procedure and return to the command level from
- which it was invoked.
-
- F3
- Display the help menu.
-
- F5
- Pause execution of a procedure or command and re-enter
- LadyBug command mode. Procedures and commands can be run and
- then the paused command can be restarted by typing CONTINUE
-
- ____________________
-
- (5) See the DOS manual for information about how to make the
- LadyBug diskette contain enough of DOS to boot up itself. With
- an AUTOEXEC.BAT file on the diskette you can have LadyBug start
- up automatically when the machine is turned on.
-
-
-
-
-
-
-
-
-
- Running LadyBug Page 6
-
-
- (or CO). F1 will stop procedures invoked from a pause level
- and return to that pause level. Procedures or commands run
- from a pause level can themselves be paused, etc.
-
- F9
- Switch on or off TRACE mode. When it is on, each command
- that is executed is displayed and LadyBug pauses for you to
- press any key.
-
- F10
- Hide or unhide the display of the LadyBug herself. (She
- looks like an arrow due to the radiation armor she wears!)
- PROCEDURES RUN FASTER TWO OR THREE TIMES FASTER WHEN SHE IS
- HIDDEN but are easier to understand when she is visible.
-
-
-
- 2.4. TRYING THINGS
-
- The procedure POLY is already defined when LadyBug starts up.
- (POLY is a simple and commonly used illustration of LOGO.) To
- try something, type DRAW(6) and then type one of these:
-
- poly 100 100
- poly 100 144
- poly 100 162
-
- Press F1 to stop the drawing; it will continue to run, retracing
- its path, until you stop it. If you press F10 while the figure
- is being drawn then the LadyBug hides. Press it again to get her
- back.
-
- Type DRAW to clear the screen and to reset the LadyBug to her
- home position.
-
- There are many examples which come with LadyBug; they are briefly
- described in appendix C. Try this:
-
- read "polyspi
- clip
- polyspi 5 144 5
-
- Press F1 to stop it. Then try:
-
- draw
- polyspi 1 45 1
-
- Or try:
-
-
- ____________________
-
- (6) DRAW tells LadyBug you want to do graphics; you only have to
- do it once at the start.
-
-
-
-
-
-
-
-
-
- Running LadyBug Page 7
-
-
- draw
- polyspi 5 175 5
-
- POLY is a three statement procedure. POLYSPI is too. The wide
- variations in each come from minor changes in how far a line is
- drawn and how much of a turn is then made. It is difficult to
- believe that the three POLYSPI drawings come from the SAME
- trivial program.
-
-
-
- 2.5. SETTING UP A LADYBUG DISKETTE
-
- LadyBug will run from the diskette it is distributed on.
- However, this diskette has many things, such as documentation, on
- it which are not needed for running LadyBug. The following
- procedure describes how to build a diskette which holds only
- those things you need.
- 1. Format a diskette with the DOS FORMAT command. Use the /S
- option if you want it to automatically startup when you turn
- on the machine.
- 2. Put the diskette from step one into the B: drive. Put the
- LadyBug diskette into the A: drive.
- 3. Issue these commands:
-
- copy a
- copy a:help*.bug b:
- copy a:profile.bug b:
-
- These files should take about 100K leaving about 60K on a DOS
- 1.1 single sided diskette, 80K on a DOS 2.0 single sided
- diskette, 220K on a DOS 1.1 double sided diskette, and 260K
- on a DOS 2.0 double sided diskette. Other .BUG files can be
- copied as needed.
- 4. If you want the diskette to automatically startup LadyBug
- when the power is turned on, you need to create an
- AUTOEXEC.BAT file. The DOS manual describes how to do this.
- The file should contain the following lines:
-
- date
- time
- ladybug
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Running LadyBug Page 8
-
-
- 2.6. WHEN SOMETHING GOES WRONG
-
- The appendix "Error Messages" lists the error messages that
- LadyBug puts out. Two of these messages indicate a problem
- within LadyBug. Hopefully these will never be printed but if
- they are it is very important that you communicate them to the
- author. These are:
-
- FATAL ERROR n AT m
- INTERNAL ERROR n
-
- The "n" and "m" are numbers which vary from error to error ane
- which are very important in determining what happened.
-
- LadyBug will almost always recover from these errors and allow
- you to continue without loss of data. However, it is recommended
- that you stop LadyBug as soon as you can afterwards and reload a
- fresh copy. Also, do not save the workspace (except into a new
- file) without examining it to make sure the error did not cause
- damage to it.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 3. THE WORKSPACE
-
-
- LadyBug provides a work area in which you keep variables and
- procedures. This work area is called a "work space".
-
- The work space initially contains only the procedure POLY. Many
- LadyBug commands add to, modify things in, or remove things from
- the workspace.
-
- COMMAND ACTION
- CLEARWS Deletes everything in the workspace
- EDIT Add or changes procedures
- ERASE Delete a procedure or all procedures
- ERNAME Delete a variable or all variables
- LOAD Load things from another workspace
- SAVE Save the workspace on disk
- TO Define a procedure
-
- These commands are described elsewhere in this manual.
-
- As you work you add things to your current workspace. When you
- are done you can either say BYE and leave LadyBug without saving
- the workspace or you can say SAVE and save it first. SAVE allows
- you to name the workspace however you wish. When you next start
- you can READ (or LOAD) that workspace and continue.
-
- You can have several workspaces for several projects or classes.
- If you have students, each can have her own workspace.
-
- The things that can go into a workspace are:
-
- Procedures
- Procedures are lists of commands that you want to run. They
- have names, such as "poly", "fred", or "polyspi", that you
- make up. Later on we will talk about how to create
- procedures.
-
- Variables
- Variables are named values. They have names, such as "x",
- "fred", or "length", that you also make up. Variables often
- are written with a semicolon like this:
-
- :x :fred :length
-
- The semicolon asks LadyBug to get the current value of the
- variable and use it. We will see these in some examples
- before we get back to discussing variables.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 4. THE LADYBUG SCREENS
-
-
- This chapter describes the different views of LadyBug seen on the
- screen.
-
- The TEXT SCREEN shows text. When the text screen is current,
- LadyBug is said to be in "Text Mode".
-
- The GRAPHICS SCREEN shows graphics. When the graphics screen is
- current, LadyBug is said to be in "Graphics Mode".
-
- The EDIT SCREEN shows procedures which can be changed. When the
- edit screen is current, LadyBug is said to be "in the editor".
-
-
-
- 4.1. THE GRAPHICS SCREEN
-
- When LadyBug starts up it is in text mode. To get into graphics
- mode, type "DRAW". In graphics mode, commands which draw are
- allowed. Commands which display text do so in a small area at
- the bottom of the screen.(7) If you forget to type DRAW, LadyBug
- will automatically switch to the graphics screen when you issue
- any command which needs it.
-
- Graphics mode is re-entered each time you give the DRAW command.
-
- The graphics screen is 300 units high by 500 units wide. The
- center is the origin.(8)
-
- The LadyBug starts at the center of the screen facing towards the
- top of the screen. This direction has a heading of zero. Turns
- to the right are considered positive and to the left are
- considered negative.
-
-
-
-
-
-
-
-
-
-
- ____________________
-
- (7) This area is two lines of up to 80 characters total.
- (8) Note that the coordinates of the LadyBug screen do not map
- exactly to the coordinates of the computers screen. This is
- because there is nothing magic about the number of dots on the
- computers screen; different modes and different computers can
- have differing numbers of dots. LadyBug can hide these
- differences.
-
-
-
-
-
-
-
-
-
- The LadyBug Screens Page 11
-
-
- 150 +----+----+----+----+----+----+----+----+----+----+
- | |
- | |
- 100 + +
- | |
- | |
- 50 + +
- | |
- | |
- 0 + + (center) +
- | |
- | |
- -50 + +
- | |
- | |
- -100 + +
- | |
- | |
- -150 +----+----+----+----+----+----+----+----+----+----+
- -250 -200 -150 -100 -50 0 50 100 150 200 250
-
- Graphics Screen Coordinates
-
-
-
- 4.2. THE TEXT SCREEN
-
- In text mode, LadyBug does not allow graphics but does allow a
- full screen of text. Text mode is entered with the NODRAW
- command.
-
-
-
- 4.3. THE EDITING SCREEN
-
- The editing screen replaces whichever screen is active when the
- EDIT or TO commands are given. When editing ends, the previous
- screen type is restored but the screen is clear.
-
-
-
- 4.4. USING TWO DISPLAYS
-
- If present, the IBM Monochrome display is used as the text screen
- and the editing screen. The graphics display always contains the
- graphics screen.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 5. THINGS WHICH MAKE UP COMMANDS
-
-
- This chapter describes the kinds of things which are used in
- LadyBug commands.
-
-
-
- 5.1. WORDS
-
- Words are groups of characters separated from each other by
- blanks.
-
- Examples:
-
- fred ***** $129.50
-
- Each of "fred", "*****", and "$129.50" are words.
-
- Some special words, such as those starting with a left bracket
- ("[") or a quote mark may contain blanks; see below.
-
-
-
- 5.2. NUMBERS
-
- Numbers are special kinds of words. Numeric values come in two
- types, integer, and floating point.
-
- Integer numbers have only whole number values. These values must
- be in the range of -32768 to 32767. Floating point numbers have
- whole number and fractional values and an optional exponent.
-
- Examples:
-
- 1 954 1.2 1.2e12
-
- Numbers are described in more detail later.
-
-
-
- 5.3. LISTS
-
- Lists start with a left bracket and end with a right bracket.
- Examples of lists include:
-
- [This is a list of words]
- [ [This is a list] [of lists] ]
-
- Within a list, the number of left and right brackets are counted.
- The end of the list occurs after the right bracket which
- corresponds to the starting left bracket. If a line ends before
- the ending bracket, it is assumed to be present.
-
-
-
-
-
-
-
-
-
-
- Things Which Make Up Commands Page 13
-
-
- 5.4. STRINGS
-
- Strings are words which start with a quote mark. Examples of
- strings are:
-
- "frank
- "(
-
- Strings may contain characters, such as a left parenthesis, which
- would otherwise be taken as something else. Strings can also
- contain blanks:
-
- Example:
-
- "'This is a string with blanks'
-
- The second character is an apostrophe; this means that every
- character up to the next apostrophe (or the end of the line) is a
- part of the word.
-
- Strings may not contain left ([) or right (]) brackets.
-
-
-
- 5.5. ABOUT CAPITAL LETTERS
-
- In this document command names are shown in capital letters.
- LadyBug will accept either capitals or lowercase for any command
- name, file identifier, procedure, variable, or other word special
- to LadyBug.
-
-
-
- 5.6. EXPRESSIONS
-
- Numbers, and variables with numbers as their values, can be
- combined into expressions. Everyplace that LadyBug is looking
- for a number you can write an expression. Expressions will be
- described in detail later in this manual.
-
- Examples:
-
- 2 + 4
- 2 +
- 4 * sin :angle
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 6. GRAPHICS COMMANDS
-
-
- This section describes the LadyBug graphics commands. These
- commands move and turn the LadyBug, paint areas, and control
- which colors are used.
-
- If issued in text mode, they cause graphics mode to be entered.
- The text on the text screen is lost. Exceptions are WINDOW,
- NOWINDOW, WRAP, NOWRAP, CLIP, NOCLIP, and SETSCRUNCH which do not
- cause graphics mode to be entered, and NODRAW which terminates
- graphics mode and starts up text mode.
-
-
-
- 6.1. BACK LENGTH (ABBREVIATED BK)
-
- Takes one number as input. Moves the LadyBug
- backwards, that is in the opposite way from which it is
- facing, the distance given by the number.
-
- Examples:
-
- back 50
- back :a + 1
- bk 2
-
-
-
- 6.2. BACKGROUND COLOR (ABBREVIATED BG)
-
- Takes a number from 0 through 15 as input. Sets the
- color according to the following table:
-
- 0 Black 8 Gray
- 1 Blue 9 Light Blue
- 2 Green 10 Light Green
- 3 Cyan 11 Light Cyan
- 4 Red 12 Light Red
- 5 Magenta 13 Light Magenta
- 6 Brown 14 Yellow
- 7 White 15 High-intensity White
-
- The change takes place immediately for the entire
- screen. Until you set a background, it is black.
-
- Examples:
-
- background 8
- bg 0
-
-
-
-
-
-
-
-
-
-
-
-
-
- Graphics Commands Page 15
-
-
- 6.3. CLEARSCREEN (ABBREVIATED CS)
-
- Takes no inputs. Clears the graphics screen but does
- not change LadyBug's position or direction.
-
- NOTE: In some LOGO systems CLEARSCREEN also puts the
- LadyBug back at the home position. For this function,
- see the DRAW command.
-
-
-
- 6.4. CLIP
-
- Takes no inputs. Tells Ladybug that lines drawn by the
- LadyBug are to be trimmed at the edge of the screen.
- If WRAP has previously been given, it is turned off.
- (That is, CLIP also does a NOWRAP.) See WRAP for more
- information.
-
- The screen acts like a window onto a large flat sheet
- on which the LadyBug draws. Only that part which is
- visible through the window is seen.
-
- Try:
-
- clip
- draw
- poly 250 170
-
-
-
- 6.5. DRAW
-
- Takes no inputs. Exits from the text mode and enters
- graphics mode. Clears the graphics screen and resets
- LadyBug to her home position and direction. (Also see
- the HOME command.)
-
-
-
- 6.6. FORWARD LENGTH (ABBREVIATED FD)
-
- Takes one number as input. Moves the LadyBug forward,
- that is in the direction it is facing, the distance
- given by the number.
-
- Examples:
-
- forward 50
- fd 10
-
-
-
-
-
-
-
-
-
-
-
-
-
- Graphics Commands Page 16
-
-
- 6.7. HIDEBUG (ABBREVIATED HB)
-
- Takes no inputs. Makes the LadyBug disappear from the
- screen. May also be written as HIDETURTLE (abbreviated
- as HT).
-
-
-
- 6.8. HIDETURTLE (ABBREVIATED HT)
-
- Takes no inputs. Makes the LadyBug disappear from the
- screen.
-
-
-
- 6.9. HOME
-
- Takes no inputs. Moves the LadyBug to the center of
- the screen and points her straight up. If the pen is
- down the LadyBug will draw as she goes home.
-
-
-
- 6.10. LEFT ANGLE (ABBREVIATED LT)
-
- Takes one input, an angle from -360 to 360. Rotates
- the LadyBug that many degrees counterclockwise.
-
- Example:
-
- left 90
-
- Try:
-
- repeat 36 [left 10]
-
-
-
- 6.11. NOCLIP
-
- Takes no inputs. Tells LadyBug that an attempt to pass
- the edge of the screen will not cause the LadyBug's
- path to be clipped. See WRAP and CLIP for more
- information.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Graphics Commands Page 17
-
-
- 6.12. NODRAW (ABBREVIATED ND)
-
- Takes no inputs. Exits from graphics mode and enters
- text mode. Clears the screen. Places the cursor in
- the upper left corner.
-
- With two screens, the graphics screen is unchanged; the
- text screen is enabled for output commands. See the
- chapter "The LadyBug Screens" on page for more
- information about screens.
-
-
-
- 6.13. NOWRAP
-
- Takes no inputs. Tells Ladybug that an attempt to pass
- the edge of the screen will not cause the LadyBug to
- wrap around to the other side. See WRAP and CLIP for
- more information.
-
-
-
- 6.14. NOWINDOW
-
- Same as NOCLIP in this chapter.
-
-
-
- 6.15. PAINT PAINTCOLOR BORDERCOLOR
-
- Paint the area under and around the LadyBug with the
- painting color. Painting is done in each direction
- until the border color is reached (or the edge is
- reached).
-
- If the border color is the same as the pen color, and
- the pen is down, the dot under the pen acts like a
- border and no painting occurs. To be safe, lift the
- pen and move forward a slight amount.
-
- Paint colors and border colors are the same as pen
- colors; see PENCOLOR for information.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Graphics Commands Page 18
-
-
- 6.16. PALETTE PALETTENUMBER
-
- Takes one input, a zero or a one. Sets the palette
- number. A palette is a set of colors from which the
- allowable pen colors and painting colors are selected.
- There are two palettes with fixed colors. See PENCOLOR
- for information on the colors in each palette.
-
-
-
- 6.17. PENCOLOR COLOR (ABBREVIATED PC)
-
- Takes one input, a number from 0 to 3. The number is
- the color of the lines that the LadyBug will draw. The
- colors are:
-
- --- Palette ---
- COLOR 0 1
- 1 Green Cyan
- 2 Red Magenta
- 3 Brown White
-
- A color of zero is the same color as the background.
- (See the BACKGROUND command.) Until you select a
- background, Ladybug uses a black background.
-
- Until you select a pen color, LadyBug uses color 3.
-
- Palettes are selected with the PALETTE command; until
- you select a palette, Ladybug uses palette one.
-
- Example:
-
- pencolor 2
-
-
-
- 6.18. PENDOWN (ABBREVIATED PD)
-
- Takes no inputs. When the pen is down, the LadyBug
- draws when she moves.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Graphics Commands Page 19
-
-
- 6.19. PENUP (ABBREVIATED PU)
-
- Takes no inputs. When the pen is up the LadyBug does
- not draw when she moves.
-
- Example:
-
- penup
- forward 20
- pendown
-
-
-
- 6.20. RIGHT ANGLE (ABBREVIATED RT)
-
- Takes one input, an angle from -360 to 360. Rotates
- the LadyBug that many degrees clockwise.
-
- Example:
-
- right 47
-
- Try:
-
- repeat 10 [right 10 left 10]
-
-
-
- 6.21. SETHEADING ANGLE (ABBREVIATED SETH)
-
- Takes one input, an angle from -32000 to +32000. THe
- angle is taken modulo 360 so that it ranges from -360
- to +360. The LadyBug is rotated so that it points in
- the direction given. An angle of zero is straight up
- and increasing numbers are clockwise.
-
- Examples:
-
- setheading 45
- seth -90
-
-
-
- 6.22. SETBG COLOR
-
- Same as BACKGROUND in this chapter.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Graphics Commands Page 20
-
-
- 6.23. SETPAL PALETTE
-
- Same as PALETTE in this chapter.
-
-
-
- 6.24. SETPC COLOR
-
- Same as PENCOLOR in this chapter.
-
-
-
- 6.25. SETSCRUNCH N (ALSO: .SETSCRUNCH)
-
- Adjust the aspect ratio of screen drawings. Initially
- it is 1.0 but can be set to any value from 0.1 to 10.
- The value is used to adjust the distance actually moved
- left-to-right relative to that requested.
-
- For example, with a value of 1.0, a FORWARD 10 moves
- the same distance left-and-right as up-and-down. With
- a value of 0.8, a FORWARD 10 would move only 8 units
- left-or-right.
-
- Scrunch is necessary since different displays and
- printers do not have the same number of dots per inch
- in each direction.
-
- You may need to experiment with SETSCRUNCH in order to
- find the best value for your screen and printer. (You
- may need to run with values which distort pictures on
- your screen in order to have printed pictures look
- right.) Once you have found a value you like, you
- might want to put it into your PROFILE.BUG file.
-
-
-
- 6.26. SETX XCOORD
-
- Takes one input, an x coordinate. Positions the
- LadyBug at the position, drawing a line if the pen is
- down.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Graphics Commands Page 21
-
-
- 6.27. SETXY XCOORD YCOORD
-
- Takes two inputs, x and y coordinates. Positions the
- LadyBug at the new position, drawing a line if the pen
- is down.
-
- Examples:
-
- setxy 0 0
- setxy ( :a + 10 ) ( :b + 1 )
-
-
-
- 6.28. SETY YCOORD
-
- Takes one input, an y coordinate. Positions the
- LadyBug at the position, drawing a line if the pen is
- down.
-
- Try:
-
- to xy
- setx 250 - random 500
- sety 150 - random 300
- xy
- end
- xy
-
-
-
- 6.29. SHOWBUG (ABBREVIATED SB)
-
- Takes no inputs. Makes the LadyBug appear on the
- screen. May also be written SHOWTURTLE (abbreviated
- ST).
-
-
-
- 6.30. SHOWTURTLE (ABBREVIATED ST)
-
- Takes no inputs. Makes the LadyBug appear on the
- screen.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Graphics Commands Page 22
-
-
- 6.31. WINDOW
-
- Same as CLIP in this chapter.
-
-
-
- 6.32. WRAP
-
- Takes no inputs. Causes the LadyBug to "wrap around"
- when it is moved past an edge. For example, a path
- that goes off the top of the screen will continue at
- the bottom of the screen.
-
- This is the default condition. The NOWRAP, CLIP, and
- NOCLIP statements also affect what happens when the
- LadyBug tries to go off of the edge.
-
- Try:
-
- wrap
- draw
- poly 200 170
-
- If neither WRAP nor CLIP is in effect, the LadyBug
- bumps into the edge of the screen. Drawings will be
- distorted.
-
- Try:
-
- nowrap
- noclip
- draw
- penup fd 100 pendown
- poly 150 170
-
- Wrap is slowest, clip the next fastest, and nowrap with
- noclip is faster still. The performance effects are
- not major but are measurable.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 7. SOUNDS
-
-
- This section describes Ladybug commands for making sounds with
- the PC speaker.
-
-
-
- 7.1. BEEP
-
- Play one short note on the speaker.
-
-
-
- 7.2. PLAY STRING
-
- Takes one input, a string. Play a series of notes on
- the speaker.
-
- This sections describes only a part of the PLAY
- command. The appendix "The Play Command" on page 60
- describes PLAY completely.
-
- The PLAY statement is the word "PLAY" followed by a
- string which contains special music commands. These
- commands define notes to play, or tell PLAY how to play
- the notes.
-
- Note: Spaces and capitalization in the PLAY statement
- are optional.
-
-
- A TO G WITH OPTIONAL '#', '+', OR '-'
-
- Play the note given. Append a # or + if the note is a
- sharp or a - if it is a flat.
-
-
- L N
-
- Set the default length of all notes which follow. For
- example, L1 means that all notes are whole notes, L2
- means half notes, and L4 means quarter notes. The
- default is L4.
-
-
- O N
-
- Set octave n as the current octave. All notes given as
- letters are in this octave. The default octave is 4.
- The value of n may be 0 through 7.
-
- An octave has the notes C, D, E, F, G, H, A and B in
- it, in that order. The octave does NOT start with the
-
-
-
-
-
-
-
-
-
- Sounds Page 24
-
-
- note A.
- P N
-
- Pause for n time units. The meaning of the value of n
- is the same as in the L command. The value of n may
- range from 1 to 64.
-
- Examples:
-
- play "ggga"
- play "l4abcde"
- play "L4 abc L8 abc"
-
- Try:
-
- load "ludwig
- ludwig
-
-
-
- 7.3. TONE FREQUENCY N
-
- Takes two inputs, a frequency and a time. Produces a
- sound with the given frequency and for "n" clock ticks.
- The clock ticks 18.2 times per second.
-
- Examples:
-
- tone 2000 20
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 8. INPUT AND OUTPUT
-
-
- This chapter describes statements which read or write data, which
- control the text screen, or which sense what is happening with a
- keyboard or joystick. These commands are value in both graphics
- mode and text mode unless noted otherwise.
-
-
-
- 8.1. CLEARTEXT (ABBREVIATED CT)
-
- Takes no inputs. Clears the text screen. Moves the
- cursor to the top left corner. Exits from graphics
- mode and enters text mode.
-
-
-
- 8.2. CLEARINPUT
-
- Takes no inputs. Clears the input buffer of text typed
- but not yet read.
-
-
-
- 8.3. CURSOR COLUMN ROW
-
- Takes two inputs which are a column and row position.
- The cursor is positioned at that place on the text
- screen. The allowed values of the numbers depend upon
- which screen size is in use. The column may be 1-40
- (or 1-80 depending upon the number of text columns) and
- the row may be 1-25. The cursor command is valid only
- in text mode.
-
- Example:
-
- cursor 20 1
-
-
-
- 8.4. PRINT WORD (ABBREVIATED PR)
-
- Takes one input which it prints on the current output
- device. Moves the cursor to the next line.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Input and Output Page 26
-
-
- 8.5. PRINT1 WORD (ABBREVIATED PR1)
-
- Takes one input which it prints on the current output
- device. Leaves the cursor on the same line.
- Equivalent to TYPE in this chapter.
-
-
-
- 8.6. TYPE WORD
-
- Takes one input which it prints on the current output
- device. Leaves the cursor on the same line.
- Equivalent to PRINT1 in this chapter.
-
-
-
- 8.7. SETWIDTH COLUMNS
-
- Same as TEXTCOLUMNS in this chapter.
-
-
-
- 8.8. TEXTCOLUMNS COLUMNS (ABBREVIATED TCOLS)
-
- Takes one input, either the number 40 or the number 80.
- Sets the screen width for text mode on the graphics
- monitor. If the text screen is on the Monochrome
- display it always has a width of 80. The command is
- value anytime but it takes effect only when in text
- mode and when text mode is displayed on the graphics
- device. On the Monochrome display, text mode always
- has 80 columns.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 9. CONTROL COMMANDS
-
-
- This chapter describes commands which are used to define
- variables and procedures.
-
-
-
- 9.1. EDIT PROCNAME ... (ABBREVIATED ED)
-
- Takes a variable number of inputs. Enters the full
- screen editor to edit the procedures. The chapter
- "Introduction to the LadyBug Editor" on page 51
- describes this command and how to use the editor.
-
- Examples:
-
- edit poly
- ed poly polyspi square
-
-
-
- 9.2. EDIT ALL
-
- Edit all procedures at one time.
-
-
-
- 9.3. END
-
- In the full screen editor, END marks the end of a
- procedure which is entered from the editor. It may be
- omitted from the last procedure but must be present if
- there is more than one procedure in the editors space.
-
- See also the TO command.
-
-
-
- 9.4. ERROR MESSAGE
-
- Takes one input, a string. Issues an error message
- with the string as the text and then terminates the
- currently active procedure set. (See the chapter
- "Running and Debugging Procedures" on page 39.)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Control Commands Page 28
-
-
- 9.5. FOREVER LIST
-
- See chapter "The Workspace Named 'TOOLS'". on page 49.
-
-
-
- 9.6. GOODBYE (ABBREVIATED BYE)
-
- Exit to DOS from LadyBug.
-
-
-
- 9.7. IF CONDITION THEN ACTION
-
- Test the condition. If it is "true", then perform the
- action. The action consists of all of the words
- remaining on the line.
-
- The condition is a word or expression which returns
- "true" or "false".
-
- The action is one or more LadyBug commands excepting an
- IF command with an ELSE clause.
-
- Example:
-
- if :x > 0 then fd 100
-
- if :ready then fd 50 rt 45 fd 100 rt 45 fd 50
-
- Also see the TEST command.
-
-
-
- 9.8. IF CONDITION [ACTION]
-
- Test the condition. If it is "true", then perform the
- action (which is a list). The action consists of the
- words in the list.
-
- The condition is a word or expression which returns
- "true" or "false".
-
- The action is one or more LadyBug commands including
- other IF commands.
-
- Examples:
-
- if :x > 0 [fd 100]
-
- if :ready [fd 50 rt 45 fd 100 rt 45 fd 50]
-
- make "alist [fd 10 rt 90 fd 90 rt 10]
- if :a > :b :alist
-
-
-
-
-
-
-
-
-
- Control Commands Page 29
-
-
- Also see the TEST command.
-
-
-
- 9.9. IF CONDITION THEN ACTION1 ELSE ACTION2
-
- Test the condition. If the result is "true", then
- perform action1; if it is "false", then perform
- action2. Action1 consists of the words between the
- THEN and the ELSE. Action2 consists of the words
- following the ELSE. Neither action can be an IF/THEN
- or an IF/THEN/ELSE command.
-
- The condition is a word or expression which returns
- "true" or "false".
-
- The actions are one or more LadyBug commands.
-
- Example:
-
- if :x > 0 then fd 100 else fd 50
-
- if :ready then fd 50 rt 45 else bk 20 lt 10
-
- Also see the TEST command.
-
-
-
- 9.10. IF CONDITION [ACTION1] [ACTION2]
-
- Test the condition. If it is "true", then perform
- action1; if it is "false", then perform action2. The
- actions consist of the words in the lists. The actions
- can contain other IF commands.
-
- The condition is a word or expression which returns
- "true" or "false".
-
- The actions are one or more LadyBug commands.
-
- Example:
-
- if :x > 0 [fd 100] [fd 50]
-
- if :ready [fd 50 rt 45] [bk 20 lt 10]
-
- Also see the TEST command.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Control Commands Page 30
-
-
- 9.11. IFFALSE LIST
-
- Takes one input, a list. Tests the condition set by
- the most recently executed TEST command. If it was
- "false" then the list is executed.
-
- Example:
-
- test :a > 7
- iffalse [fd 5 rt 5]
-
-
-
- 9.12. IFTRUE LIST
-
- Takes one input, a list. Tests the condition set by
- the most recently executed TEST command. If it was
- "true" then the list is executed.
-
- Example:
-
- test :a > 7
- iftrue [fd 5]
-
-
-
- 9.13. LOCAL VARIABLENAME
-
- Defines a variable as being local to the current
- procedure. It is available to any procedures which are
- called from the procedure in which it is defined unless
- they too make the name local or have an input variable
- with the same name.
-
- The variable has a null (empty) value until some value
- is assigned with the MAKE command. See the MAKE
- command for more information about how LadyBug searches
- for variables.
-
- The LOCAL command should always be used in procedures
- which use variables for 'personal' reasons, such as
- temporarily holding the results of some calculation.
-
- Example:
-
- local "saveit
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Control Commands Page 31
-
-
- A longer example:
- to a
- make "fred 1 <--- sets variable 'fred' to 1
- print :fred <--- prints the value '1'
- b <--- calls procedure 'b'
- print :fred <--- prints the value '2'
- end
-
- to b
- make "fred 2 <--- sets same 'fred' as in 'a'
- local "fred <--- makes a new local 'fred'
- make "fred 3 <--- sets the new 'fred' to 3
- print :fred <--- prints the value '3'
- c <--- call procedure 'c'
- end <--- returns to procedure 'a'
-
- to c
- print :fred <--- prints the value '3'
- end
-
- If "a" is invoked, the four values printed are 1, 3, 3,
- and 2 in that order. After "a" is through, the
- variable "fred" still has the value 2.
-
-
-
- 9.14. MAKE "VARIABLENAME VALUE
-
- Takes two inputs, a word which will be a variable name,
- and a value. The value may be an expression, a list,
- or a string. MAKE assigns the value to a variable with
- the name given. The value may be referenced by using
- the variable name with a colon on the front.
-
- If there already is a variable with the name given, the
- value replaces its current value. If there is not
- already such a variable, one is created and given the
- value.
-
- Examples:
-
- make "a 7
- make "b 3 * :a
- make "c ( :a / :b ) + 2
-
- NOTE: At any time that LadyBug is looking for a
- variable, the variables created by the current
- procedure are examined first. If one with the needed
- name is not found, LadyBug then looks at variables
- created by the procedure which called the current one.
- If it has such a variable, it is used. If not, then
- variables in the procedure that called that one are
- examined, etc. Finally, variables which are not a part
- of any procedure but which are a part of the workspace
-
-
-
-
-
-
-
-
-
- Control Commands Page 32
-
-
- are examined. If no variable is found, then MAKE makes
- a new variable. It is local to the current procedure
- if one is active.
-
- New variables created by MAKE are global. That is,
- they will still exist after all active procedures
- terminate and will be saved when the workspace is
- saved.
-
- See the LOCAL command for information about another way
- to create variables and for information about the scope
- of variables in procedures which call one another.
-
-
-
- 9.15. OUTPUT VALUE (ABBREVIATED OP)
-
- Takes one input. Causes the current procedure to stop.
- The value is output to the calling procedure.
-
- Examples:
-
- output 2
- output ( :a + 4 ) / 3
- op [2 3 4]
-
-
-
- 9.16. RANDOMIZE NUMBER
-
- Takes one input, an integer. Sets the seed of the
- random number generator to this value. Each time the
- same seed is used, calls to RANDOM will return the same
- sequence of random numbers.
-
- Examples:
-
- randomize 2127
- randomize :seed + 1173
-
-
-
- 9.17. REPEAT NUMBER LIST
-
- Takes two inputs, a number and a list. RUNs the list
- as many times as the number indicates.
-
- Examples:
-
- repeat 4 [forward 100 right 90]
- repeat :n :alist
-
-
-
-
-
-
-
-
-
-
-
-
- Control Commands Page 33
-
-
- 9.18. RUN LIST
-
- Takes one input, a list. Executes the list as if the
- body were typed as a command line.
-
- Example:
-
- run [fd 10 rt 5]
-
- Example:
-
- make "b [fd 10 rt 5]
- run :b
-
-
-
- 9.19. STOP
-
- Takes no inputs. Causes the current procedure to stop
- and return control to the procedure which called it, if
- any, else or to the command prompt. No value is
- output.
-
-
-
- 9.20. TEST CONDITION
-
- Takes one input, a condition. The condition is a word
- or expression which returns "true" or "false". The
- condition is evaluated and the result is remembered; it
- can be tested by the IFTRUE and IFFALSE commands.
-
-
-
- 9.21. TOPLEVEL
-
- Takes no inputs. Stops all active commands, procedures
- and PAUSEs. Returns to the command prompt.
-
-
-
- 9.22. WAIT TIME
-
- See chapter "Workspaces With Tools". on page 49.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Control Commands Page 34
-
-
- 9.23. WHILE CONDITION LIST
-
- See chapter "Workspaces With Tools" on page 49.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 10. MANAGING THE WORKSPACE
-
-
- This chapter describes statements which are used to control and
- manage the workspace.
-
-
-
- 10.1. CATALOG (ABBREVIATED CAT)
-
- Takes no inputs. Prints the names of files contained
- on the current disk. The current screen is cleared and
- the catalog is displayed as if in text mode.
-
-
-
- 10.2. CLEARWS
-
- Takes no inputs. Clears all variables and procedures
- from the workspace.
-
-
-
- 10.3. DEFINE "NAME LIST
-
- Takes two inputs which define a procedure. The first
- is the name of the procedure and the second is the body
- of the procedure. If a procedure already exists with
- the name given, the old one is deleted.
-
- The body of the procedure is a list of lists. Each
- sublist is one line of the procedure. The first
- sublist contains the names of the inputs to the
- procedure.
-
- Example:
-
- to tri :s
- repeat 3 [fd :s rt 120]
- end
-
- can be defined as:
-
- define "tri [[:s][repeat 3 [fd :s rt 120]]]
-
- If there are no inputs then the first sublist is empty:
-
- Example:
-
- to circ
- fd 10
- rt 10
- circ
- end
-
-
-
-
-
-
-
-
-
- Managing the Workspace Page 36
-
-
- can be defined as:
-
- define "circ [[][fd 10][rt 10][circ]]
-
-
-
- 10.4. EDIT PROCNAME ...
-
- Takes a variable number of inputs. Enters the full
- screen editor to edit the procedures. The chapter
- "Introduction to the LadyBug Editor" on page 51
- describes this command and how to use the editor.
-
- Examples:
-
- edit poly
- ed poly polyspi square
-
-
-
- 10.5. EDIT ALL
-
- Edit all procedures at one time.
-
-
-
- 10.6. ERASE PROCEDURENAME
-
- Delete the procedure named.
-
- Example:
-
- erase "poly
-
- NOTE: ERASE can be used to delete a procedure from
- within itself without disturbing the execution of the
- procedure.
-
-
-
- 10.7. ERASE ALL
-
- Delete all procedures.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Managing the Workspace Page 37
-
-
- 10.8. ERASEFILE FILENAME
-
- Erase the disk file named.
-
- Example:
-
- erasefile "b:brough.bug
-
-
-
- 10.9. ERNAME VARIABLENAME
-
- Delete the variable named.
-
- Example:
-
- ername "bart
-
-
-
- 10.10. ERNAME ALL
-
- Delete all variables.
-
-
-
- 10.11. LOAD FILENAME
-
- Same as READ in this chapter.
-
-
-
- 10.12. PRINTOUT NAME (ABBREVIATED PO)
-
- Print the value of the variable and/or definition of
- the procedure with the name given.
-
- Example:
-
- printout "elephant
-
-
-
- 10.13. READ FILENAME
-
- Load the named workspace and add its variables and
- procedures to the workspace. If no file extension is
- given, .BUG is used.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Managing the Workspace Page 38
-
-
- Examples:
- read "polyspi
- read "b:circ.lgo
-
- See the chapter "Hints on Using LadyBug" on page 54 for
- more information about uses of READ.
-
-
-
- 10.14. SAVE FILENAME
-
- Save the current workspace in the file named. If no
- file extension is given, the default of .BUG is used.
-
- Example:
-
- save "bobby
- save "b:whoops.2
-
- The appendix "Format and Contents of Saved Workspaces"
- on page describes the format of the workspace as it is
- saved on disk.
-
-
-
- 10.15. TO PROCNAME INPUTS...
-
- Takes one or more inputs. The first is the name of a
- procedure which is to be defined. If a procedure with
- the same name already exists the old definition is
- deleted.
-
- The remaining inputs are the names of inputs to the new
- procedure.
-
- All lines read after the TO command become lines in the
- new procedure. A line containing the word END alone,
- ends the definition of the new procedure.
-
- Example:
-
- to poly :dist :angle
- fd :dist
- rt :angle
- poly :dist :ang
- end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 11. RUNNING AND DEBUGGING PROCEDURES
-
-
- This chapter describes how to run procedures and describes some
- commands which help debug them.
-
-
-
- 11.1. RUNNING PROCEDURES
-
- Procedures are groups of commands which are saved under a name
- for later execution. Procedures are created with the LadyBug
- editor, with the TO command, or with the DEFINE command.
-
- A procedure is run by giving its name instead of the name of a
- command.
-
- Example:
-
- to moveup
- forward 20
- end
-
- This defines a procedure named MOVEUP. The procedure can be run
- by typing its name, MOVEUP. In effect, procedures are new
- commands and the term "command" often is used to refer to
- procedures as well as predefined, or builtin, commands.
-
- Procedures can invoke, or call, other procedures. When several
- procedures are active at one time, the group is often called a
- "nest" of procedures or a "nested group" or procedures.
-
-
-
- 11.2. PAUSING PROCEDURES
-
- Procedures, as well as commands like REPEAT which have a list of
- other commands in them, can be temporarily stopped with the pause
- key, F5, or with a PAUSE command imbedded in them.
-
- When a procedure has been paused, LadyBug accepts commands and
- will execute any command. It indicates that some other command
- has been paused by printing the word "pause" instead of a
- question mark for a command prompt.
-
- It is possible to run other procedures while a procedure is
- paused. The new procedure or procedure nest can itself be
- paused. Then yet another procedure can be run, and that one
- paused, and so on subject only to the restriction of 40 active
- procedures, repeat commands, pauses, loads, and active expression
- evaluations at one time.
-
- The group or nest of procedures that is suspended by a PAUSE or
- by F5 is called a "Procedure set". The F1 key terminates only
-
-
-
-
-
-
-
-
-
- Running and Debugging Procedures Page 40
-
-
- the currently active procedure set. Thus, if you use F1 to
- terminate a procedure run while another is paused, only it will
- be terminated. The TOPLEVEL command terminates all procedure
- sets.
-
-
-
- 11.3. EDITING ACTIVE PROCEDURES
-
- It is possible to edit a procedure which is active. Either the
- EDIT command can be in a procedure or the EDIT command can be
- given after the running procedure has been paused.
-
- However, the changes made to the procedure do not affect any
- currently active execution of that procedure.
-
-
-
- 11.4. CONTINUE (ABBREVIATED CO)
-
- The continue command resumes execution of a paused
- procedure set.
-
-
-
- 11.5. NOTRACE
-
- Turn off tracing.
-
-
-
- 11.6. PAUSE
-
- Pause the current nest of procedures.
-
-
-
- 11.7. TOPLEVEL
-
- Terminate all active procedures in all active procedure
- sets, and all active commands. Return to the top level
- command prompt.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Running and Debugging Procedures Page 41
-
-
- 11.8. TRACE
-
- Turn on tracing. When trace is on, each command that
- is executed from any source, procedure or command
- prompt, is shown and LadyBug pauses for a key to be
- pressed.
-
- F9 also turns on and off tracing.
-
-
-
- 11.9. ; (COMMENT)
-
- Any line which starts with a semicolon is a comment
- line. The contents of the line are ignored.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 12. NUMBERS AND COMPUTATIONS
-
-
- This section describes numbers and how to compute with them.
-
-
-
- 12.1. VALUES
-
- Numeric values come in two types, integer, and floating point.
-
- Integer numbers have only whole number values. These values must
- be in the range of -32768 to 32767.
-
- Floating point numbers have whole number and fractional values
- and an optional exponent. Their value in the computer may range
- from 2.9x10**(-39) to 1.7x10**38 (where the 10**(-39) means
- "times ten to the -39 power" and 10**38 means "times ten to the
- 38th power".) When you enter the numbers into the computer, they
- must have one of the forms, for example:
-
- 1. .2 1.2 1E2 1.E2 .2E2 1.2E2 1.2E-2 1.2e2
-
- Each may also have a sign. The "e" or "E" separates the number
- from its power of ten.
-
-
- 12.1.1. NUMERIC VALUES
-
- Several words in Ladybug have values. None of the following take
- any inputs:
-
- BACKGROUND (Abbreviated BG)
- The background color.
-
- HEADING
- The angle that the LadyBug is currently facing. The value
- ranges from -359 to 359.
-
- PALETTE
- The palette number.
-
- PENCOLOR (Abbreviated PC)
- The color of the pen.
-
- SCRUNCH
- The value of the aspect ratio asjustment. See the SETSCRUNCH
- command.
-
- XCOR
- The current x coordinate of the LadyBug.
-
-
-
-
-
-
-
-
-
-
-
-
- Numbers and Computations Page 43
-
-
- YCOR
- The current y coordinate of the LadyBug.
-
-
- 12.1.2. MATHEMATICAL VALUES
-
- These Ladybug words take one value (an expression) and return a
- number.
-
- ABS number
- Returns the absolute value of the number.
-
- ARCTAN tangent
- Returns the angle which has the tangent given.
-
- COS angle
- Returns the cosine of the angle in degrees.
-
- EXP power
- Returns the mathematical quantity 'e' raised to the power
- given.
-
- INTEGER number
- Returns the integer which is equal to or just smaller than
- the number given. If the number is negative the result is
- smaller when it is "further away" from zero.
-
- LOG number
- Returns the logarithm of the number taken to base 10.
-
- RANDOM range
- Returns a random number in the range 0 to 'range'. (See the
- RANDOMIZE statement for more information.)
-
- SIGN number
- Returns +1 if number is positive, 0 if number is zero, and -1
- if number if negative.
-
- SIN angle
- Returns the sine of the angle in degrees.
-
- SQRT number
- Returns the square root of the number.
-
- TAN angle
- Returns the tangent of the angle in degrees.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Numbers and Computations Page 44
-
-
- Examples:
- GIVEN PRINTS
- print abs -7 7
- print integer 7.7 7
- print integer -3.3 -4
- print log 100 10
- print random 10 2.32 (example result)
- print sign 4 1
- print sign -4 -1
- print sqrt 4 2
-
-
-
- 12.2. GRAPHICS WORDS
-
- The following words return values. Some take one input.
-
- STICK n (or PADDLE n)
- Takes a number from 0 to 3 which corresponds to one of four
- joysticks and returns a number from 0 to 255 which represents
- it's setting. The range of values will depend upon the
- particular joystick used.
-
- STICKBUTTON n (or PADDLEBUTTON n)
- Takes a number from 0 to 3 which corresponds to one of four
- joysticks and returns TRUE or FALSE depending upon whether or
- not the button on the particular joystick has been pressed
- since the last time PADDLEBUTTON was used.
-
- RC? or KEYP
- Takes no inputs. Outputs TRUE if a keyboard character is
- pending, that is, if the character input buffer is not empty.
- Otherwise it outputs FALSE.
-
- READCHARACTER (Abbreviated READCHAR or RC)
- Takes no inputs. Outputs the least recent character in the
- character buffer, or waits for a character if the buffer is
- empty.
-
- REQUEST (Abbreviated RQ)
- Takes no inputs. Waits for an input line to be typed and
- outputs the line. The line is terminated by pressing the
- enter key. Until the enter key is pressed, the backspace key
- will move back over and delete characters that have been
- typed in response to REQUEST, the back arrow key will move
- back over and allow insertions and deletions with the Ins and
- Del keys, and the ESC key will delete everyting typed so far.
-
- PENUP? and PENDOWN?
- Neither takes an input. Both return either "true" or "false"
- depending upon whether the pen is up or down.
-
-
-
-
-
-
-
-
-
-
-
-
- Numbers and Computations Page 45
-
-
- SHOWING? and HIDDEN?
- Neither takes an input. Both return either "true" or "false"
- depending upon whether the LadyBug is showing or hidden.
-
-
-
- 12.3. OTHER WORDS
-
- NUMBER? word
- Takes one input. Returns "true" if the word represents a
- number and "false" if it does not.
-
- RUN list/word/string
- Takes one input, a list, string, or word. RUNs the input and
- returns it's output.
-
- Example:
-
- make "x [2 + 3]
- print run :x
-
- The example prints the number "5".
-
- WORD word1 word2
- Takes two inputs and combines them into one word.
-
- Example:
-
- make "x word "a "b
-
- The variable x is set to "ab".
-
- SENTENCE word/list word/list (Abbreviated SE)
- Takes two inputs, words or lists. Forms a list of the words
- or the components of the lists, and returns the new list.
-
- Examples:
-
- make "x sentence [a b] [c d]
- make "x sentence joe [frank bob]
-
- THING word
- Takes one input, a word which is the name of a variable.
- Returns the value of that variable. The following are
- exactly equivalent:
-
- Example:
-
- :elephant
- thing "elephant
-
-
-
-
-
-
-
-
-
-
-
-
-
- Numbers and Computations Page 46
-
-
- CHAR expression
- Takes one input, a number from 0 to 255. Returns the ASCII
- character which corresponds to that number.
-
- ASC string
- Takes one input, a string or word. Returns a number from 0
- to 255 which is the ASCII code for the first character of the
- string or word.
-
-
-
- 12.4. EXPRESSIONS RESULTING IN NUMBERS
-
- Numbers can be combined into expressions. Expressions are
- evaluated from left to right with no operator hierarchy.
- Parentheses may be used to group operations which should be
- performed first.
-
- Expressions are taken, word by word, with only blanks separating
- words. Operators, numbers, and parentheses must be separated by
- blanks to be properly recognized. For example, this is invalid:
-
- FORWARD 3+4
-
- but this is valid:
-
- FORWARD 3 + 4
-
- Expressions may occur anywhere that LadyBug is looking for a
- number or a truth value. Even though an expression may have many
- words in it, it is still considered as one input.
-
- Unless noted, operations on integers result in integers and
- operations on floating point numbers result in floating point
- numbers. When one operand of two given for an operator is
- integer, it is converted to floating point.
-
- The operators taking two values are:
-
- + (plus)
- Returns the sum of two numbers.
-
- - (minus)
- Returns the difference of two numbers.
-
- * (times)
- Returns the product of two numbers.
-
- / (divide)
- Returns the result of dividing the first number by the second
- number. If both are integers, they are converted to floating
- point before the divide is done.
-
-
-
-
-
-
-
-
-
-
-
- Numbers and Computations Page 47
-
-
- ^ (power)
- Returns the first number raised to the power given by the
- second number. The second number must be an integer or
- LadyBug signals an error.
-
- \ (mod)
- Returns the remainder from dividing the first number by the
- second number. If either is floating point, it is rounded to
- an integer first.
-
- Examples:
-
- forward 3 * ( 2 + 5 )
- right 5 * :x
- right ( 5 * :x )
- make "x :x + 1
- print integer 100 * sin 4 + :angle
- print integer ( 100 * sin ( 4 + :angle ) )
-
- The last two lines print the same result.
-
-
-
- 12.5. EXPRESSIONS RESULTING IN TRUE OR FALSE
-
- Expressions which result in "true" or "false" are similar to
- expressions which result in numbers and may have such expressions
- in them. Each expression has the following form:
-
- value1 op value2
-
- where the values are numbers, variables, or expressions and "op"
- is one of the following relational operators:
-
- <
- Returns 'true' if value1 is less than value2.
-
- <=
- Returns 'true' if value1 is less than or equal to value2.
-
- >
- Returns 'true' if value1 is greater than value2.
-
- >=
- Returns 'true' if value1 is greater than or equal to value2.
-
- <>
- Returns 'true' if value1 is not equal to value2.
-
- =
- Returns 'true' if value1 is equal to value2.
-
- Conditionals can be combined with AND and OR. See the chapter
- "Workspace With Tools" on page 49.
-
-
-
-
-
-
-
-
-
- Numbers and Computations Page 48
-
-
- In addition:
-
- NOT value
- Returns "true" when the value is "false" and "false" when the
- value is "true".
-
- Examples:
-
- GIVEN PRINTS
- print 2 < 3 true
- print 3 > 2 false
- print 2 <= 3 true
- print 2 <> 3 true
- print not 2 < 3 false
-
-
-
- 12.6. PROCEDURES
-
- Procedures can be invoked from within expressions and can return
- values. When LadyBug finds a word in an expression it looks
- first to see if the word is a number. If not, it looks to see if
- the word is one of the special words described in this chapter.
- If not, it looks to see if the word is the name of a procedure in
- the workspace.
-
- If the word is the name of a procedure, it is invoked. The
- procedure must terminate with an OUTPUT command which specifies a
- value suitable for the context in which it was invoked. (For
- example, if the procedure follows a plus sign, it would be
- expected to return a number.)
-
- Example:
-
- to inc :v
- return :v + 1
- end
-
- print 5 + v 6
-
- The procedure adds one to its input. It is invoked in the PRINT
- command with an input of 6. The returned value, a 7, is added to
- the 5 and a 12 is printed.
-
- LadyBug has the restriction that a procedure cannot be started
- when the inputs to another procedure are being evaluated. The
- following, for example, is invalid:
-
- Example:
-
- print 5 + v v 6
-
- If allowed, it would increment the 6 twice.
-
-
-
-
-
-
-
-
-
-
-
-
-
- 13. WORKSPACES WITH TOOLS
-
-
- This chapter describes procedures which are in the workspace
- named TOOLS. An appendix describes other workspaces which
- contain example procedures.
-
-
-
- 13.1. AND T/F T/F
-
- Takes two inputs, both expressions which evaluate to
- "true" or "false". Returns "true" only if both inputs
- are "true".
-
- Example:
-
- and :a < 2 :b > 4
-
-
-
- 13.2. FOREVER LIST
-
- Takes one input, a list. RUNs the list over and over,
- forever.
-
- Example:
-
- if and :a > 3 :a < 10 [fd :a]
-
-
-
- 13.3. MAX VALUE1 VALUE2
-
- Takes, two inputs, both expressions which return some
- value. Returns the largest of the two.
-
-
-
- 13.4. MIN VALUE1 VALUE2
-
- Takes, two inputs, both expressions which return some
- value. Returns the smallest of the two.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Workspaces With Tools Page 50
-
-
- 13.5. OR T/F T/F
-
- Takes two inputs, both expressions which evaluate to
- "true" or "false". Returns "true" if either input is
- "true"..
-
- Example:
-
- if or :a > 3 :a < 10 [fd :a]
-
-
-
- 13.6. WAIT TIME
-
- Takes one input, a time in seconds. LadyBug pauses for
- this length of time.
-
-
-
- 13.7. WHILE [CONDITION] [COMMANDS]
-
- Takes two inputs, a condition and commands. Each input
- is given as a list. The condition is an expression
- which returns "true" or "false".. The condition is
- evaluated and, if true the list of commands is RUN.
- The condition is again evaluated and the list RUN.
- This is repeated so long as the condition remains true.
-
- Example:
-
- while [heading < 200] [fd 10 rt 10]
-
-
-
- 13.8. XOR T/F T/F
-
- Takes two inputs, both expressions which evaluate to
- "true" or "false". Returns "false" if both inputs are
- the same and "true" if different.
-
- Example:
-
- if xor :a > 3 :a < 10 [fd :a]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 14. INTRODUCTION TO THE LADYBUG EDITOR
-
-
- This chapter describes the basics of using the LadyBug full
- screen editor. The appendix "About the LadyBug Editor" on page
- 57 describes additional features of the editor.
-
-
-
- 14.1. ABOUT THE EDITOR
-
- The LadyBug Editor is a full screen editor for LadyBug
- procedures. It displays one or more procedures totalling up to
- 500 lines long and with lines up to 254 characters long. It uses
- the Monochrome display or 40 or 80 column graphics display.
-
- The screen is a window onto the file. The window can move up,
- down, left and right. Lines which are longer than the screen are
- partly displayed. If you insert data, characters seem to be lost
- off of the end of the line; they are not lost but are just no
- longer displayed. Move the cursor off of the screen to the right
- and they will reappear as the window moves.
-
- If memory becomes nearly full, the LadyBug Editor tells you and
- lets you continue editing but won't let you add more lines.
-
-
-
- 14.2. INVOKING THE EDITOR
-
- Command: EDIT procname1 ... (Abbreviated ED)
- or: EDIT ALL
-
- Takes a variable number of inputs each of which is a procedure
- name or a vaiable name which has as a value a procedure name.
- Enters the full screen editor to edit the procedures.
-
- The procedures named are displayed, each ending with an END
- command. If ALL is given, all procedures are edited. Lines may
- be changed, added, deleted, or moved. When multiple procedures
- are being edited, lines may be moved between procedures.
-
- If a procedure is deleted in the editor, or its name is changed,
- it is not deleted from the workspace. Only those procedures
- which are still in the editors space when you terminate editing
- are moved back to the workspace. New procedures created within
- the editor are added to the workspace when you edit from the
- editor. Use the ERASE statement to delete procedures from the
- workspace.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Introduction to the LadyBug Editor Page 52
-
-
- 14.3. THE LADYBUG EDITOR KEYS
-
- The following list defines the meaning of each key.
-
- Backspace
- Backspace over and delete the previous character.
-
- Character keys, shifted and unshifted.
- Enter the character into the current line. If in insert
- mode, put it at the cursor position and slide the characters
- under and to the right of the cursor to the right. If in
- replace mode, replace the character under the cursor.
-
- Cursor keys (arrows on numeric keypad)
- Move the cursor up, down, left, or right one position. If
- the cursor would move off of the screen in a direction in
- which there is more data, then scroll the screen one
- character in that direction.
-
- Del
- Delete the character under the cursor. Slide the characters
- at its right to the left one position.
-
- End
- Position the cursor past the end of current line.
-
- Enter key
- Put a new line in the file and position the cursor at the
- front of it.
-
- F5
- Clear the current line and position the cursor at the left
- edge.
-
- F6
- Clear the current line under and to the right of the cursor.
-
- F7
- Quit editing. Abandon the procedure(s) being edited. (If
- any changes have been made, the editor asks before
- abandoning them.)
-
- F9
- End editing. Save the procedure(s) being edited.
-
- Home
- Position the cursor in the first column of both the current
- file line and the screen.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Introduction to the LadyBug Editor Page 53
-
-
- Ins
- Toggle between insert and replace modes. The status line
- describes which is in effect. The cursor also changes size.
-
- Pg Dn
- Scroll down 20 lines when the screen is 80 characters wide
- and 18 lines when 40 wide.
-
- Pg Up
- Scroll up 20 lines when the screen is 80 characters wide and
- 18 lines when 40 wide.
-
- Shift-F8
- Delete the line at the cursor. The cursor moves to the next
- line in the file.
-
- Tab
- Tab right to the beginning of the next word. (Words are
- groups of characters separated by blanks.)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 15. HINTS ON USING LADYBUG
-
-
- This chapter contains several helpful hints about how to use
- LadyBug effectively.
-
-
-
- 15.1. PRINTING THE SCREEN ON AN IBM OR EPSON PRINTER
-
- Under DOS 2.0 (or later systems) you must give the GRAPHICS
- command in DOS before running LadyBug. Under DOS 1.1 or 1.0
- there is no way to print the graphics screen unless you have a
- GRAPHICS command distributed with the IBM Graphics printer for
- that version, or an equivalent. If the printer is an Epson, it
- must have the GrafTrax feature builtin or added.
-
-
-
- 15.2. PRINTING THE SCREEN ON OTHER PRINTERS
-
- The manufacturers of many dot matrix printers provide software
- which will print the graphics screen. Other routines are
- available through various PC clubs.
-
-
-
- 15.3. TAILORING LADYBUG: THE PROFILE
-
- When LadyBug starts up, it READs a workspace named PROFILE.BUG.
- This workspace file can be modified to contain any LadyBug
- commands. When it is read, the commands will be executed.
-
- For example, the PROFILE might contain:
-
- pencolor 1
- background 7
-
-
-
- 15.4. THE READ COMMAND
-
- The READ command described on page 37 causes LadyBug to
- temporarily stop reading commands from the keyboard. Commands
- are read instead from the file named.
-
- Any LadyBug command can be in the file. However, there is no way
- to create a file from within LadyBug which contains arbitrary
- commands. It is necessary to use a program called an "editor" to
- create the file.(9)
-
- ____________________
-
- (9) The author of LadyBug has a free editor called FRED which
-
-
-
-
-
-
-
-
-
- Hints On Using LadyBug Page 55
-
-
- The READ command can itself occur within a READ command. And
- another READ in that one, and another read in that one. The
- limit is four active READ commands.
-
- When LadyBug starts up, it READs a file named PROFILE.BUG. This
- file may be modified to perform any action you wish as a part of
- the startup process.
-
- READ files can be created which contain long sequences of
- commands to draw large pictures. The commands are executed and
- discarded; they do not take space in the workspace unless they
- are MAKE, TO, or DEFINE commands.
-
-
-
- 15.5. PERFORMANCE HINTS
-
- Major performance improvements:
- - Hide the LadyBug using HB or function key F10. Procedures
- may run as much as 3 times faster with the LadyBug hidden.
- - Unwind procedures. Of the following, POLYB is 30 percent
- faster than POLYA.
-
- to polya :d :a
- fd :d rt :a
- poly :d :a
- end
-
- to polyb :d :a
- fd :d rt :a
- fd :d rt :a
- poly :d :a
- end
-
- - Repeat instead of recurse. POLYC is 50 percent faster than
- POLYA.
-
- to polyc :d :a
- repeat 1000 [fd :d rt :a]
- poly :d :a
- end
-
- Minor improvements:
- - Turn on NOCLIP and NOWRAP when there is no danger of needing
- them.
- - Put multiple statements on a line.
-
-
- ____________________
-
- will create such files; send a diskette in a self-addressed,
- post-paid diskette mailer for a free copy. FRED is very similar
- to the LadyBug editor. However any editor will do, including the
- EDLIN program which comes with DOS.
-
-
-
-
-
-
-
-
-
- Hints On Using LadyBug Page 56
-
-
- In any case, don't worry about these performance improvements
- until you have proven that you need them. Premature use of them
- will simply complicate the creation process.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- APPENDIX A. ABOUT THE LADYBUG EDITOR
-
-
- This appendix describes the LadyBug editor completely. It
- repeats the introductory information given in the main part of
- the document.
-
- The LadyBug Editor is a full screen editor for LadyBug
- procedures. It displays procedures or groups of procedures up to
- 500 lines long and with lines up to 254 characters long. It uses
- the IBM Monochrome display or 40 or 80 column graphics display.
-
- The screen is a window onto the file. The window can move up,
- down, left and right. Lines which are longer than the screen are
- partly displayed. If you insert data, characters seem to be lost
- off of the end of the line; they are not lost but are just no
- longer displayed. Move the cursor off of the screen to the right
- and they will reappear as the window moves.
-
- If memory nears the limit while you are editing, the LadyBug
- Editor tells you and lets you continue editing but won't let you
- add more lines.
-
-
-
- A.1. THE LADYBUG EDITOR KEYS
-
- The following list defines the meaning of each key. The term
- "current line" means the line the cursor is currently on.
-
- Alt-d
- Delete a marked area; see Alt-l for more information.
-
- Alt-j
- Join the next line onto the current one at its end.
-
- Alt-l
- Mark the current line or extend a group of marked lines.
- The first Alt-l marks a line and displays it in reverse
- video. The second marks all lines from the first one
- through the second. Further Alt-l keystrokes extend the
- marked area to the current line (or shrink it from the
- nearest edge).
-
- Marked areas may be copied, deleted, or unmarked. See
- Alt-z, Alt-d, and Alt-u.
-
- Alt-s
- Split the current line into two parts at the cursor. At
- column one this adds a new line before the current one.
-
-
-
-
-
-
-
-
-
-
-
-
-
- About the LadyBug Editor Page 58
-
-
- Alt-u
- Unmark an area; see Alt-l.
-
- Alt-z
- Copy a marked area to just after the current line. A marked
- area cannot be copied into itself.
-
- Backspace
- Backspace over and delete the previous character.
-
- Character keys, shifted or unshifted.
- Enter the character into the current line. If in insert
- mode, put it at the cursor position and slide the characters
- under and to the right of the cursor to the right. If in
- replace mode, replace the character under the cursor.
-
- Ctrl-End
- Position the cursor on the last line of the file. Keep it
- in the same column.
-
- Ctrl-Home
- Position the cursor on the top line of the file. Keep it in
- the same column
-
- Ctrl-Left
- Move the cursor to the left 40 positions.
-
- Ctrl-Pg Dn
- Position the cursor at the bottom edge of the screen (or on
- the last line of the file if encountered first). The column
- position is unchanged.
-
- Ctrl-Right
- Move the cursor to the right 40 positions.
-
- Cursor keys (arrows on numeric keypad)
- Move the cursor up, down, left, or right one position. If
- the cursor would move off of the screen in a direction in
- which there is more data, then scroll the screen one
- character in that direction.
-
- Del
- Delete the character under the cursor. Slide characters at
- its right to the left one position.
-
- End
- Position the cursor past the end of current line.
-
- Enter key
- Put a new line in the file and position the cursor at the
- front of it. (Also see Alt-s.)
-
-
-
-
-
-
-
-
-
-
-
-
- About the LadyBug Editor Page 59
-
-
- F5
- Clear the current line and position the cursor at the left
- edge.
-
- F6
- Clear the current line under and to the right of the cursor.
-
- F7
- Quit editing. If any procedure has been changed, you will
- be prompted for a 'y' before the LadyBug Editor really
- quits.
-
- F9
- Stop editing. Re-enter LadyBug mode with the changed
- procedure(s).
-
- Home
- Position the cursor in the first column of both the current
- file line and the screen.
-
- Ins
- Toggle between insert and replace modes. The status line
- describes which is in effect.
-
- Pg Dn
- Scroll down 20 lines when the screen is 80 columns wide and
- 18 lines when it is 40 wide.
-
- Pg Up
- Scroll up 20 lines when the screen is 80 columns wide and 18
- lines when it is 40 wide.
-
- Shift-F4
- Undo a change to the current line. Once the cursor is moved
- from the line the change cannot be undone with this key.
-
- Shift-F8
- Delete the line at the cursor. The cursor moves to the next
- line in the file.
-
- Tab
- Tab right to the beginning of the next word. (Words are
- groups of characters separated by blanks.)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- APPENDIX B. THE PLAY COMMAND
-
-
- This appendix describes the PLAY command completely, repeating
- information contained in the summary in the main part of this
- document.
-
- The PLAY statement is the word "PLAY" followed by a string which
- contains special music commands. These commands define notes to
- play, or tell PLAY how to play the notes.
-
- Note: Spaces and capitalization in the PLAY statement are
- optional.
-
-
-
- B.1. MUSIC COMMANDS
-
-
- A TO G WITH OPTIONAL '#', '+', OR '-'
-
- Play the note given. Append a # or + if the note is a sharp or a
- - if it is a flat.
-
-
- LN
-
- Set the default length of all notes which follow. For example,
- L1 means that all notes are whole notes, L2 means half notes, and
- L4 means quarter notes. The default is L4.
-
- The value of n may vary from 1 to 64. The actual note length is
- 1/n. That is, if n is 8 then the note has a length of 1/8.
- Unless changed by the T command, each quarter note lasts 1/2
- second.)
-
- The default length may be changed for any note by appending a
- different length to it. For example, in
-
- PLAY "'L4 a b c8'
-
- the notes 'a' and 'b' will be played as quarter notes but 'c'
- will be an eighth note.
-
-
- MB
-
- Tell PLAY to play music in the background; that is, to start the
- music playing and to proceed to the next statement. If LadyBug
- then finds another SOUND or PLAY statement, it pauses until the
- tune is complete. Up to 32 notes (or rests) may be played in the
- background. MB is NOT the default.
-
- Once you have given the MB command in one PLAY statement that all
-
-
-
-
-
-
-
-
-
- The PLAY Command Page 61
-
-
- further PLAY statements run in the background.
- MF
-
- Play music in the foreground; that is, wait for the music to
- complete before proceeding to the next statement. This is the
- default.
-
-
- MN
-
- Play notes the "normal" length of time. (MN means Music Normal.)
- This is defined as 7/8th of the time specified by the note
- length. The other 1/8 of the time is silence.
-
-
- ML
-
- Play notes the full time specified by the note length. (ML means
- Music Legato). There is NO pause between notes.
-
-
- MS
-
- Play notes 3/4 of the time specified by the note length. (MS
- means Music Staccato.) The other 1/4 of the time it rests.
-
-
- N N
-
- Play note n. The value of n may range from 0 to 84 with 0
- meaning a rest (no sound). Note 1 is the C of octave zero.
-
-
- O N
-
- Set octave n as the current octave. All notes given as letters
- are in this octave. The default octave is 4. The value of n may
- be 0 through 7. For example, the following two commands are
- equivalent:
-
- PLAY "O0c
- PLAY "N1
-
- An octave has the notes C, D, E, F, G, H, A and B in it, in that
- order. The octave does NOT start with the note A.
-
- The table below shows the frequencies for each note. The values
- in octaves three and above have been rounded to integers. The
- minus signs mean "flat".
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- The PLAY Command Page 62
-
-
- ---------------- Octave ----------------
- Note 0 1 2 3 4 5 6
- ------ ----------------------------------------
- c 32.7 65.4 130.8 262 523* 1046 2093
- c# d- 34.6 69.3 138.6 277 554 1109 2217
- d 36.7 73.4 146.8 294 587 1175 2349
- d# e- 38.9 77.8 155.6 311 622 1244 2489
- e 41.2 82.4 164.8 330 659 1318 2637
- f 43.7 87.3 174.6 349 698 1397 2794
- f# g- 46.2 92.5 185.0 370 740 1480 2960
- g 49.0 98.0 196.0 392 784 1568 3136
- g# a- 51.9 103.8 207.7 415 831 1661 3322
- a 55 110 220 440 880 1760 3520
- a# b- 58.3 116.5 233.1 466 932 1865 3729
- b 61.7 123.5 246.9 494 988 1975 3951
- * - Middle C
-
- Frequencies for Seven Octaves
-
-
- P N
-
- Pause for n time units. The meaning of the value of n is the
- same as in the L command. The value of n may range from 1 to 64.
-
-
- T N
-
- Set the tempo. The tempo is the number of quarter notes per
- minute The value of n may range from 32 to 255. The default is
- 120.
-
- This means that there are 120 quarter notes per minute or that
- each quarter note begins 1/2 second after the previous quarter
- note.
-
-
- A DOT (.)
-
- A dot, placed after a note, causes the note to be played 3/2 the
- time it would otherwise be played. A second dot multiplies the
- length again by 3/2 giving a result of 9/4 the time of the
- original note. Dots may also appear after the P and N commands.
-
- Note: There are two kinds of dotted notes in music; those with a
- dot BELOW the note which means staccato, and those with one or
- two dots AFTER the note which means to change the note timing.
-
- PLAY's dot convention differs from that used in normal music
- notation where the first dot after a note adds 1/2 of the note
- time, and a second dot adds 1/2 of 1/2 to the note time. Thus a
- note with double dots would have a length of 7/4 of its original
- length rather than the 9/4 that PLAY has.
-
-
-
-
-
-
-
-
-
-
- The PLAY Command Page 63
-
-
- DEFAULTS
-
- The defaults given are what you get when LadyBug first starts up.
- However, if you change the default in one PLAY statement, it
- stays changed for further statements.
-
-
-
- B.2. EXAMPLES OF PLAY STATEMENTS
-
- This sections illustrates the use of the Play statement. The
- workspace named SOUNDS contains all of the following examples of
- Play and additional ones.
-
- First, a space ship:
-
- Example:
-
- to ship1
- play "'L64 T255'
- repeat 10 [play "'n40 n42 n44 n46 n48 n50 n48 n46 n44 n42 n40']
-
- Now, a clock ticking:
-
- Example:
-
- to clock :tics
- play "'L50 MB MS T255'
- repeat :tics [play "'N1 P1 N2 P1']
-
- And now, a bird call:
-
- Example:
-
- to bird1
- play "'L64 MB ML T255 O4'
- play "'N64 N66 N68 N70 P64'
- play "'N66 N68 N70 N72 N74 N76 N78 P64'
- play "'N66 N68 N70 N72 P64'
- play "'N64 N66 N68 N70 P64'
- play "'N70 N72 N74 N76 N78 N80 P64'
- play "'N66 N68 N70 N72 P64'
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- APPENDIX C. A GUIDE TO EXAMPLE PROCEDURES
-
-
- This chapter describes the example workspaces which come with
- LadyBug. Each section name below is the name of a workspace.
- Issue the command:
-
- READ "name
-
-
-
- C.1. BCAKE
-
- to bcake :age
-
- Draws a birthday cake in color and plays Happy Birthday.
- Submitted by Daniel D. Wheeler, Cincinnati, OH. Try:
-
- bcake 5
-
-
-
- C.2. C
-
- to c :size :level
-
- Draws a "C". curve. Adapted from a procedure in TURTLE GRAPHICS.
- Try:
-
- C 5 6
-
-
-
- C.3. DYNA
-
- to startup
- to dt :age
-
- Displays the "Dyna Turtle". The dyna turtle is really the
- LadyBug acting like a space ship under the influence of Newton's
- Laws. It starts off motionless at the home position. The "r"
- and "l." keys turn the ship 30 degrees right and left. The "k"
- key "kicks" the ship in the direction it is pointing.
-
- Adapted from LOGO FOR THE APPLE II.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- A Guide To Example Procedures Page 65
-
-
- C.4. DRAGON
-
- to dragon :size :order
-
- Draws a dragon curve. Adapted from TURTLE GRAPHICS. Try:
-
- dragon 5 11
-
-
-
- C.5. DUOPOLY
-
- duopoly :side1 :angle1 :side2 :angle2
-
- Adapted from TURTLE GRAPHICS. Try:
-
- duopoly 12 10 12 -15
- duopoly 18 19 18 -20
- duopoly 45 90 45 320
- duopoly 12 10 4 -15
-
-
-
- C.6. HILBERT
-
- hilbert :size :level
-
- Adapted from TURTLE GRAPHICS, page 98. Draws a Hilbert curve.
- Try:
-
- hilbert 10 3
- hilbert 5 5
-
-
-
- C.7. INSPI
-
- to inspi :side :angle :inc
-
- Adapted from various LOGO books. Draws an inward spiral with an
- increasing inturning angle; it thus eventually turns out. Slight
- differences in the angle make totally different pictures. For
- example, try:
-
- inspi 10 10 15
- inspi 10 10 16
- inspi 10 10 10
- inspi 10 10 7
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- A Guide To Example Procedures Page 66
-
-
- C.8. LUDWIG
-
- to ludwig
-
- Plays a tune by Beethoven. Adapted from a BASIC program; author
- unknown.
-
-
-
- C.9. MISC
-
- to corner.tri :size
- to cornerpoly :size :angle :totalturn
- to nested.triangle :size
- to rays :angle :incangle :dist :incdist
- to tree :l
- to outward.tri :size
- to spiralsq
-
- CORNER.TRI draws a triangle with smaller triangles on the
- corners.
-
- CORNERPOLY does a similar thing for general polygons.
-
- NESTER.TRIANGLE draws triangles inside triangles inside
- triangles.
-
- Rays draws rays out from the current position. The rays increase
- in length and angle with time.
-
- TREE draws a simple tree.
-
- OUTWARD.TRI is similar to CORNER.TRI.
-
- SPIRALSQ draws a square with the given size. Rotates the turtle
- 45 degrees and draws another square with a side the length of the
- diagonal of the first square. Repeats the process with even
- increasing squares. Adapted from LOGO FOR THE APPLE II.
-
- Most of these are adapted from TURTLE GRAPHICS.
-
-
-
- C.10. POLY
-
- to poly :side :angle
-
- The basic LOGO procedure. It draws polygons. Try:
-
- poly 100 90
- poly 100 120
- poly 100 144
- poly 100 162
-
-
-
-
-
-
-
-
-
-
- A Guide To Example Procedures Page 67
-
-
- C.11. POLYSPI
-
- to polyspi :side :angle :inc
-
- Very similar to POLY but the side is incremented after each time
- it is drawn. Try:
-
- polyspi 1 45 1
- polyspi 5 119 3
- polyspi 5 120 3
- polyspi 5 144 3
-
-
-
- C.12. RAIL
-
- to rail
-
- Rail plays a familiar old song but with a complexity that seems
- impossible considering the instrument. It is adapted from
- RAIL.BAS which was on a disk someone gave the author of LadyBug;
- there was no name on the RAIL program. Other procedures in the
- workspace are rail1 through rail15 and are called by rail. Try:
-
- rail
-
-
-
- C.13. SLINKY
-
- to shrinkcircle :size
- to rslinky :size
- to spinslink :size
- to growcircle :size
-
- A set of circle drawing tools adapted from LOGO FOR THE APPLE II.
- Try:
-
- shrinkcircle 100
- rslinky 50
- spinslinky 50
- growcircle 10
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- A Guide To Example Procedures Page 68
-
-
- C.14. SNOWFLAK
-
- to snowflake :size :level
-
- Draws a snowflake. Try:
-
- snowflake 100 2
- snowflake 100 3
-
-
-
- C.15. SPIRO
-
- to spiro :size :angle :max
-
- Adapted from TURTLE GRAPHICS. Try:
-
- spiro 5 45 10
- spiro 10 120 7
- spiro 10 90 9
-
-
-
- C.16. SOUNDS
-
- to ship1
- to ship2
- to ship3
- to clicks
- to clock :tics
- to bird1
- to bird2
- to bird3
- to bird4
- to birds
-
- A number of different sounds. Ships are space ships, not ocean
- ships. The clock ticks the number of times given. "Birds" makes
- various bird calls. Try:
-
- birds
- clock 20
- ship1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- A Guide To Example Procedures Page 69
-
-
- C.17. SPINSQ
-
- to spinsquares :size
-
- Draws a square and turns 20 degrees to the right. Repeats the
- process. Try:
-
- spinsquares 50
-
-
-
- C.18. TREES
-
- to vee
- to branch
- to bush
- to greentree
- to treemove
- to trees
-
- Adapted from LOGO FOR THE APPLE II. Try:
-
- trees
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- APPENDIX D. FORMAT AND CONTENTS OF SAVED WORKSPACES
-
-
- Workspaces are saved on disk with the SAVE command and are
- reloaded with the LOAD command. The saved workspace reflects the
- definitions of procedures and values of variables that existed
- when the SAVE command was executed.
-
- The status of currently executing commands or procedures is not
- saved.
-
- The workspace is saved on disk such that the file contains
- commands which can be executed to rebuild the workspace or to add
- the workspace contents to another workspace.
-
- For example, you issue the commands:
-
- clearws
-
- to poly :d :a
- ; the standard, simple, POLY procuedure
- fd :d
- rt :a
- end
-
- make "abc "'Some value'
- make "n 4 * 5
-
- save "dave
-
- The file DAVE.BUG looks like this:
-
- to "poly :d :a
- ; the standard, simple, POLY procuedure
- fd :d
- rt :a
- end
-
- make "abc "'Some value
- make "n 20
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- APPENDIX E. ERROR MESSAGES
-
-
- (PROCEDURE) DIDN'T OUTPUT ANYTHING.
- The procedure was invoked in an expression but did not
- terminate with an OUTPUT command.
-
- (COMMAND) DOESN'T LIKE (NUMBER) AS INPUT.
-
- (COMMAND) DOES NOT LIKE (WORD) AS INPUT.
-
- (COMMAND) DOESN'T LIKE TO WORK AFTER YOU SAID DRAW.
- The command works only in text mode; issue the NODRAW
- command and try again.
-
- (COMMAND) DOESN'T LIKE TO WORK AFTER YOU SAID NODRAW.
- The command works only in graphics mode; issue the RAW
- command and try again.
-
- (COMMAND) DOESN'T LIKE (WORD/LIST/STRING) AS INPUT.
- The input does not match what the command expects.
-
- (COMMAND) HAS TOO MANY INPUTS
-
- (COMMAND) NEEDS MORE INPUTS.
-
- BACKGROUND DOESN'T LIKE COLOR NUMBER OF (NUMBER)
-
- CANNOT RAISE NUMBER TO NON-INTEGRAL VALUE
-
- CANNOT RUN A PROCEDURE WHILE STARTING UP A PROCEDURE.
-
- CURSOR POSITION IS OFF OF SCREEN: (NUMBER) (NUMBER)
-
- DEFINE DOESN'T LIKE (WORD/STRING) AS INPUT.
- DEFINE must have a word as its first input and alist as its
- second input.
-
- DON'T KNOW HOW TO DO ARITHMETIC ON (WORD)
-
- DON'T KNOW WHAT TO DO WITH OUTPUT VALUE: (VALUE)
- A procedure ended with an OUTPUT command but the procedure
- was not invoked as a part of an expression.
-
- ERROR CONVERTING (WORD) TO A NUMBER
- The word was in an expression, or in a place where a number
- was expected, but was not a valid number.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Error Messages Page 72
-
-
- FATAL ERROR (NUMBER) AT (LINE)
- Whoops! This should never happen but it might. Please let
- the author know.
-
- FILE NOT FOUND
- A disk file was not found.
-
- I DON'T KNOW HOW TO (COMMAND)
- LadyBug could not find the command in its internal table of
- commands and could not find a procedure with the name.
-
- I DON'T KNOW HOW TO PLAY THIS: (TUNE)
- Something is wrong with the music specification.
-
- INTERNAL ERROR (NUMBER)
- Whoops! This should ever happen but it might. Please let
- the author know.
-
- INVALID SYMBOL: (NAME)
-
- LADYBUG DOESN'T LIKE TO SCRUNCH THIS MUCH: (NUMBER)
- SETSCRUNCH can accept numbers from .1 to 10 only.
-
- MAXIMUM NUMBER OF SYMBOLS REACHED WITH (SYMBOL)
- The symbol table is full. This might happen if you have a
- very large number of procedures and/or variables. It might
- also happen if you have paused many times without going back
- to the top level command prompt.
-
- MISSING VALUE AFTER (WORD)
-
- PAINT DOESN'T LIKE PAINT COLOR NUMBER OF (NUMBER)
-
- PAINT DOESN'T LIKE BOUNDARY COLOR NUMBER OF (NUMBER)
-
- PALETTE DOESN'T LINE PALETTE NUMBER OF (NUMBER)
-
- PENCOLOR DOESN'T LINE COLOR NUMBER OF (NUMBER)
-
- PROCEDURE NESTING IS TOO DEEP.
- Too many procedures, repeats, pauses, or uncompleted
- expressions.
-
- PROCEDURE (WORD) WAS NOT FOUND.
-
- RAN OUT OF ROOM IN EXPRESSION.
- Too many procedures, repeats, pauses, or uncompleted
- expressions.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Error Messages Page 73
-
-
- RUN DOESN'T LIKE (WORD) AS INPUT. IT EXPECTS A LIST.
-
- TEST DOESN'T LIKE (WORD) AS INPUT.
-
- TOO MANY ACTIVE FILE REFERENCES; (WORD) IGNORED.
- Commands executed as a result of a READ command have issued
- other READ command to a depth of four.
-
- TOO MANY REPEAT STATEMENTS ACTIVE.
- Too many procedures, repeats, pauses, or uncompleted
- expressions.
-
- VARIABLE (NAME) WAS NOT FOUND.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- APPENDIX F. HACKERS ONLY
-
-
- This appendix contains commands which may be of interest to
- advanced LadyBug users. (Advanced users who care about esoteric
- commands are often called "hackers".)
-
-
-
- F.1. .DEBUG
-
- Turn on debug mode. In debug mode, each command is
- printed as it is encountered; LadyBug does not pause.
- On occassion, other output also occurs.
-
-
-
- F.2. .STACK
-
- Display the execution stack showing what procedures,
- repeats, and pauses are active.
-
-
-
- F.3. .SYMTAB
-
- Display the symbol table. The name, value, and type of
- every symbol is shown.
-
-
-
- F.4. NAMES THAT RETURN VALUES.
-
- .LOWWATER
-
- Returns the position in the symbol table of the last symbol
- belonging to the next procedure up the nest. Symbols at
- .lowwater + 1 were defined by the current procedure.
-
- .NVSYM
-
- The number of symbols in the symtol table. Some of the
- entries may be empty; if so, their .vval will be "NoToken".
-
- .VSYM n
-
- The name of the n'th varible in the symbol table. Procedures
- have the name proc:procname; POLY is named proc:poly.
-
- .VVAL n
-
- The value of the n'th variable in the symbol table.
-
-
-
-
-
-
-
-
-
-
-
- Hackers Only Page 75
-
-
- .VTYPE n
-
- The type of the n'th variable in the symtol table. The types
- can be "NoToken", "String", "Word", "List", or "Number".
- Each is currently padded with blanks to a length of 8
- characters.
-
- WARNING These commands and words are documented for use in
- debugging procedures, not for building applications. Their
- definition may change in future releases of LadyBug.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- APPENDIX G. LIMITS AND CAPACITIES
-
-
- Maximum total procedures and variables in workspace
- 200
-
- Maximum total procedure, repeat, pause, read/load, expression,
- and parenthesis nesting depth
- 40 total, but see below
-
- Maximum number of editor lines
- 500
-
- Maximum procedure size, in characters
- 32760
-
- Procedures can appear to nest much deeper than the limit of 30
- due to the recognition of "tail recursion". When the last thing
- a procedure does is call itself, LadyBug recognizes that it need
- not keep information about the old procedure call since it is
- essentially done. Therefore such a call does not increase the
- nesting depth.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- INDEX
-
-
- =, 48
- <=, 48
- >, 48
- >=, 48
- ^, 47
- \, 47
- *, 47
- +, 47
- <, 48
- <>, 48
- -, 47
-
-
-
- --- A ---
-
- ABS keyword, 44
- AND procedure, 50
- ARCTAN keyword, 44
- Arithmetic operator
- *, 47
- +, 47
- -, 47
- /, 47
- \, 47
- ^, 47
- Aspect ratio, 21, 43
- Author, i
- AUTOEXEC.BAT file, 5
- Automatic startup, 5
-
-
-
- --- B ---
-
- BACK command, 15
- Background colors, 15, 43
- BACKGROUND command, 15
- BACKGROUND keyword, 43
- Backup, 5
- BEEP command, 24
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Index Page 78
-
-
- --- C ---
- CATALOG command, 36
- Changes in this version, 3
- CLEARINPUT command, 26
- CLEARSCREEN command, 16
- CLEARTEXT command, 26
- CLEARWS command, 36
- CLIP, 15
- CLIP command, 16
- CO Command, 41
- Color
- background, 15
- numbers, 15
- painting, 18
- palette, 19
- pen colors, 19, 43
- Command prompt, 40
- Comment Command, 42
- CONTINUE Command, 41
- Copying, ii
- COS keyword, 44
- Cursor
- positioning, 26
- CURSOR command, 26
-
-
-
- --- D ---
-
- DEFINE command, 36
- Defining procedures, 28
- Diskette
- setting up for execution, 7
- Distribution, secondary, ii
- DOS, 2
- DOS GRAPHICS command, 55
- DRAW, 15
- DRAW command, 6, 16
-
-
-
- --- E ---
-
- ED command, 52
- EDIT command, 28, 37, 52
- Editing active procedures, 41
- Editing files, 28, 52, 58
- Editing screen, 11
- Editor key
- Alt-d: delete area, 58
- Alt-j: join lines, 58
- Alt-l: mark lines, 58
- Alt-s: split lines, 58
- Alt-u: unmark lines, 59
-
-
-
-
-
-
-
-
-
- Index Page 79
-
-
- Alt-z: copy lines, 59
- Backspace, 53, 59
- Character keys, 53, 59
- Ctrl-End: move to end of file, 59
- Ctrl-Home: move to start of file, 59
- Ctrl-Left: left 40 columns, 59
- Ctrl-Pg Dn: to bottom edge, 59
- Ctrl-Right: right 40 columns, 59
- Cursor keys, 53, 59
- Del, 53, 59
- End, 53
- End: to end of line, 59
- Enter key, 53, 59
- F5: clear line, 53, 60
- F6: clear to EOL, 53, 60
- F7: quit editing, 53, 60
- F9: End editing, 53
- F9: stop editing, 60
- Home, 53, 60
- Ins, 54, 60
- Pg Dn, 54, 60
- Pg Up, 54, 60
- Shift-F4: undo, 60
- Shift-F8: delete line, 54, 60
- Tab, 54, 60
- EDLIN editor, 55
- END command, 28, 52
- ERASE command, 37, 37
- ERASEFILE command, 38
- ERNAME command, 38, 38
- ERROR command, 28
- EXP keyword, 44
- Expressions, 14, 47
-
-
-
- --- F ---
-
- File
- PROFILE.BUG, 21, 55, 56
- Floating point numbers, 43
- FOREVER command, 29
- FOREVER procedure, 50
- FORWARD command, 16
- FRED editor, 55
- Function key
- F10: hide LadyBug, 6
- F1: stop drawing, 5
- F3: help, 5
- F5: pause, 5
- F5: Pausing execution, 40
- F9: trace mode, 6
-
-
-
-
-
-
-
-
-
-
-
- Index Page 80
-
-
- --- G ---
- GOODBYE command, 29
- Graphics commands, 15
- Graphics mode, 10, 15, 16, 18, 26
- Graphics screens, 10
-
-
-
- --- H ---
-
- HEADING keyword, 43
- HIDDEN? keyword, 45
- HIDEBUG command, 17
- HIDETURTLE command, 17
- HOME command, 17
-
-
-
- --- I ---
-
- IF command, 29, 29, 30, 30
- IFFALSE command, 31
- IFTRUE command, 31
- Initialization, 55
- Input and output, 26
- INTEGER keyword, 44
- Integer numbers, 43
-
-
-
- --- J ---
-
- Joystick, 45
-
-
-
- --- K ---
-
- KEYP keyword, 45
-
-
-
- --- L ---
-
- LEFT command, 17
- Limits, 40, 76
- Lists, 13, 46
- LOAD command, 38
- LOCAL command, 31
- LOG keyword, 44
-
-
-
-
-
-
-
-
-
-
-
-
-
- Index Page 81
-
-
- --- M ---
- MAKE command, 32
- MAX procedure, 50
- MIN procedure, 50
- Monochrome display, 2, 12, 52, 58
-
-
-
- --- N ---
-
- Nested group of procedures, 40
- Nest of procedures, 40
- NOCLIP, 15
- NOCLIP command, 17
- NODRAW, 15, 15
- NODRAW command, 18
- NOT keyword, 48
- NOTRACE Command, 41
- NOWINDOW, 15
- NOWINDOW command, 18
- NOWRAP, 15
- NOWRAP command, 18
- NUMBER? keyword, 46
- Numbers, 13
- floating point, 43
- integers, 43
-
-
-
- --- O ---
-
- OR procedure, 51
- OUTPUT command, 33
-
-
-
- --- P ---
-
- PADDLEBUTTON keyword, 45
- PADDLE keyword, 45
- PAINT command, 18
- Painting, 18
- PALETTE command, 19
- PALETTE keyword, 43
- PAUSE Command, 41
- Pausing, 51
- Pausing procedures, 40
- PC/DOS, 2
- PC keyword, 43
- PENCOLOR command, 19
- PENCOLOR keyword, 43
- PENDOWN command, 19
- PENDOWN? keyword, 45
- PENUP command, 20
-
-
-
-
-
-
-
-
-
- Index Page 82
-
-
- PENUP? keyword, 45
- Performance hint, 6, 23
- Performance Hints, 56
- PLAY command, 24, 61
- examples, 64
- POLY procedure, 6
- POLYSPI procedure, 6
- PRINT1 command, 27
- PRINT command, 26
- Printing data, 26
- Printing the screen, 55
- PRINTOUT command, 38
- Procedures, 9, 40
- as commands, 40
- creating, 40
- defining, 28, 36, 39, 52
- maximum number of, 76
- maximum size, 76
- pausing, 40
- returning from, 34
- returning values from, 33
- running, 40
- tail recursion, 76
- Procedure set, 28
- PROFILE.BUG file, 21, 55, 56
-
-
-
- --- R ---
-
- RANDOMIZE command, 33
- RANDOM keyword, 44
- RC? keyword, 45
- RC keyword, 45
- READCHARACTER keyword, 45
- READCHAR keyword, 45
- READ command, 38, 55
- References, 1
- Relational expressions, 48, 50
- Relational operator
- <, 48
- <=, 48
- <>, 48
- =, 48
- >, 48
- >=, 48
- REPEAT command, 33
- REQUEST keyword, 45
- Requirements, 2
- RIGHT command, 20
- RQ keyword, 45
- RUN command, 34
- RUN keyword, 46
- Running LadyBug, 5
-
-
-
-
-
-
-
-
-
- Index Page 83
-
-
- --- S ---
- SAVE command, 39
- Screens, 10
- printing, 55
- width, 27
- SCRUNCH keyword, 43
- SE keyword, 46
- SENTENCE keyword, 46
- SETBG command, 20
- SETHEADING command, 20
- SETPAL command, 21
- SETPC command, 21
- SETSCRUNCH, 15
- SETSCRUNCH command, 21
- .SETSCRUNCH command, 21
- Setup for execution, 7
- SETWIDTH command, 27
- SETX command, 21
- SETXY command, 22
- SETY command, 22
- SHOWBUG command, 22
- SHOWING? keyword, 45
- SHOWTURTLE command, 22
- SIGN keyword, 44
- SIN keyword, 44
- Sounds
- playing tunes, 24
- single notes, 25
- Source code, iii
- SQRT keyword, 44
- STICKBUTTON keyword, 45
- STICK keyword, 45
- STOP command, 34
- Strings, 14
-
-
-
- --- T ---
-
- TAN keyword, 44
- TEST command, 34
- TEXTCOLUMNS command, 27
- Text mode, 11, 15, 16, 18, 26, 27
- Text screen, 11
- THING keyword, 46
- TO command, 39
- TONE command, 25
- Tools workspacea, 50
- TOPLEVEL Command, 41
- TOPLEVEL command, 34
- TRACE Command, 41
- TYPE command, 27
-
-
-
-
-
-
-
-
-
-
-
- Index Page 84
-
-
- --- U ---
- User Supported Software, i, ii
-
-
-
- --- V ---
-
- Variables, 9
- assigning, 32
- creating, 32
- maximum number of, 76
- scope, 31, 32
- scope example, 32
-
-
-
- --- W ---
-
- WAIT command, 34
- WAIT procedure, 51
- Warrantee, disclaimer of, i
- WHILE command, 35
- WHILE procedure, 51
- WINDOW, 15
- WINDOW command, 23
- WORD keyword, 46
- Words, 13
- Workspace, 9
- managing, 36
- WRAP, 15
- WRAP command, 23
-
-
-
- --- X ---
-
- XCOR keyword, 43
- XOR procedure, 51
-
-
-
- --- Y ---
-
- YCOR keyword, 44
- Young People's LOGO Association, 1
- YPLA, 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-